Remove date logic checks based on vanilla version (#15951)

* Remove date logic checks based on vanilla version

* SixMH: baseUrl for CI
This commit is contained in:
stevenyomi 2023-04-04 23:39:27 +08:00 committed by GitHub
parent 68e63e408a
commit f2321f698b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 23 additions and 44 deletions

View File

@ -9,7 +9,7 @@ import org.jsoup.nodes.Document
import rx.Observable import rx.Observable
import rx.Single import rx.Single
class Gufengmh : SinMH("古风漫画网", "https://www.123gf.com") { class Gufengmh : SinMH("古风漫画网", "https://www.gufengmh.com") {
override fun mangaDetailsParse(document: Document): SManga = override fun mangaDetailsParse(document: Document): SManga =
super.mangaDetailsParse(document).apply { super.mangaDetailsParse(document).apply {

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.multisrc.sinmh package eu.kanade.tachiyomi.multisrc.sinmh
import eu.kanade.tachiyomi.AppInfo
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
@ -166,7 +165,7 @@ abstract class SinMH(
val list = document.select(sectionSelector).sectionsDescending().flatMap { section -> val list = document.select(sectionSelector).sectionsDescending().flatMap { section ->
section.select(itemSelector).map { chapterFromElement(it) }.sortedDescending() section.select(itemSelector).map { chapterFromElement(it) }.sortedDescending()
} }
if (isNewDateLogic && list.isNotEmpty()) { if (list.isNotEmpty()) {
val date = document.selectFirst(dateSelector)!!.textNodes().last().text() val date = document.selectFirst(dateSelector)!!.textNodes().last().text()
list[0].date_upload = DATE_FORMAT.parse(date)?.time ?: 0L list[0].date_upload = DATE_FORMAT.parse(date)?.time ?: 0L
} }
@ -267,7 +266,6 @@ abstract class SinMH(
companion object { companion object {
private val DATE_FORMAT by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) } private val DATE_FORMAT by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) }
private val isNewDateLogic = AppInfo.getVersionCode() >= 81
private val sortNames = arrayOf("按发布排序", "按发布排序(逆序)", "按更新排序", "按更新排序(逆序)", "按点击排序", "按点击排序(逆序)") private val sortNames = arrayOf("按发布排序", "按发布排序(逆序)", "按更新排序", "按更新排序(逆序)", "按点击排序", "按点击排序(逆序)")
private val sortKeys = arrayOf("post/", "-post/", "update/", "-update/", "click/", "-click/") private val sortKeys = arrayOf("post/", "-post/", "update/", "-update/", "click/", "-click/")
} }

View File

@ -6,11 +6,11 @@ import generator.ThemeSourceGenerator
class SinMHGenerator : ThemeSourceGenerator { class SinMHGenerator : ThemeSourceGenerator {
override val themeClass = "SinMH" override val themeClass = "SinMH"
override val themePkg = "sinmh" override val themePkg = "sinmh"
override val baseVersionCode = 8 override val baseVersionCode = 9
override val sources = listOf( override val sources = listOf(
SingleLang( SingleLang(
name = "Gufeng Manhua", name = "Gufeng Manhua",
baseUrl = "https://www.123gf.com", baseUrl = "https://www.gufengmh.com",
lang = "zh", lang = "zh",
className = "Gufengmh", className = "Gufengmh",
sourceName = "古风漫画网", sourceName = "古风漫画网",

View File

@ -1,3 +1,7 @@
## 1.3.19 (2023-04-03)
- 设置章节日期时不再错误地检查应用版本
## 1.3.18 (2023-01-12) ## 1.3.18 (2023-01-12)
- 修复繁体站点章节列表错乱的问题 - 修复繁体站点章节列表错乱的问题

View File

@ -5,7 +5,7 @@ ext {
extName = 'Baozi Manhua' extName = 'Baozi Manhua'
pkgNameSuffix = 'zh.baozimanhua' pkgNameSuffix = 'zh.baozimanhua'
extClass = '.Baozi' extClass = '.Baozi'
extVersionCode = 18 extVersionCode = 19
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -5,7 +5,6 @@ import android.content.SharedPreferences
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import com.github.stevenyomi.baozibanner.BaoziBanner import com.github.stevenyomi.baozibanner.BaoziBanner
import eu.kanade.tachiyomi.AppInfo
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
@ -77,7 +76,6 @@ class Baozi : ParsedHttpSource(), ConfigurableSource {
} }
} }
} }
if (!isNewDateLogic) return@apply
val date = document.select("em").text() val date = document.select("em").text()
if (date.contains('年')) { if (date.contains('年')) {
this[0].date_upload = date.removePrefix("(").removeSuffix(" 更新)") this[0].date_upload = date.removePrefix("(").removeSuffix(" 更新)")
@ -282,6 +280,5 @@ class Baozi : ParsedHttpSource(), ConfigurableSource {
private const val CHAPTER_ORDER_AGGRESSIVE = "2" private const val CHAPTER_ORDER_AGGRESSIVE = "2"
private val DATE_FORMAT by lazy { SimpleDateFormat("yyyy年MM月dd日", Locale.ENGLISH) } private val DATE_FORMAT by lazy { SimpleDateFormat("yyyy年MM月dd日", Locale.ENGLISH) }
private val isNewDateLogic = AppInfo.getVersionCode() >= 81
} }
} }

View File

@ -6,7 +6,7 @@ ext {
extName = 'Roumanwu' extName = 'Roumanwu'
pkgNameSuffix = 'zh.roumanwu' pkgNameSuffix = 'zh.roumanwu'
extClass = '.Roumanwu' extClass = '.Roumanwu'
extVersionCode = 3 extVersionCode = 4
isNsfw = true isNsfw = true
} }

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.extension.zh.roumanwu package eu.kanade.tachiyomi.extension.zh.roumanwu
import eu.kanade.tachiyomi.AppInfo
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
@ -46,7 +45,7 @@ data class Book(
name = it name = it
} }
}.apply { }.apply {
if (isNewDateLogic && !updatedAt.isNullOrBlank()) { if (!updatedAt.isNullOrBlank()) {
this[lastIndex].date_upload = DATE_FORMAT.parse(updatedAt)?.time ?: 0L this[lastIndex].date_upload = DATE_FORMAT.parse(updatedAt)?.time ?: 0L
} }
} }
@ -57,16 +56,6 @@ data class Book(
companion object { companion object {
private val DATE_FORMAT = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH) private val DATE_FORMAT = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH)
private val isNewDateLogic = run {
val commitCount = AppInfo.getVersionName().substringAfter('-', "")
if (commitCount.isNotEmpty()) {
// Preview
commitCount.toInt() >= 4442
} else {
// Stable
AppInfo.getVersionCode() >= 81
}
}
} }
} }

View File

@ -6,7 +6,7 @@ ext {
extName = '6Manhua / Qixi Manhua' extName = '6Manhua / Qixi Manhua'
pkgNameSuffix = 'zh.sixmh' pkgNameSuffix = 'zh.sixmh'
extClass = '.SixMH' extClass = '.SixMH'
extVersionCode = 7 extVersionCode = 8
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.extension.zh.sixmh
import android.app.Application import android.app.Application
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.AppInfo
import eu.kanade.tachiyomi.lib.unpacker.Unpacker import eu.kanade.tachiyomi.lib.unpacker.Unpacker
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.POST
@ -37,9 +36,15 @@ class SixMH : HttpSource(), ConfigurableSource {
override val lang = "zh" override val lang = "zh"
override val supportsLatest = true override val supportsLatest = true
private val isCi = System.getenv("CI") == "true"
override val baseUrl get() = when {
isCi -> MIRRORS.zip(MIRROR_NAMES) { domain, name -> "http://www.$domain#$name" }.joinToString()
else -> _baseUrl
}
private val mirrorIndex: Int private val mirrorIndex: Int
private val pcUrl: String private val pcUrl: String
override val baseUrl: String private val _baseUrl: String
init { init {
val preferences = Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000) val preferences = Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
@ -53,7 +58,7 @@ class SixMH : HttpSource(), ConfigurableSource {
mirrorIndex = index mirrorIndex = index
pcUrl = "http://www.$domain" pcUrl = "http://www.$domain"
baseUrl = "http://$domain" _baseUrl = "http://$domain"
} }
private val json: Json by injectLazy() private val json: Json by injectLazy()
@ -164,7 +169,7 @@ class SixMH : HttpSource(), ConfigurableSource {
} }
} }
if (isNewDateLogic && list.isNotEmpty()) { if (list.isNotEmpty()) {
document.selectFirst(".cy_zhangjie_top font")?.run { document.selectFirst(".cy_zhangjie_top font")?.run {
list[0].date_upload = dateFormat.parse(ownText())?.time ?: 0 list[0].date_upload = dateFormat.parse(ownText())?.time ?: 0
} }
@ -211,7 +216,6 @@ class SixMH : HttpSource(), ConfigurableSource {
val MIRRORS get() = arrayOf("6mh67.com", "qiximh3.com") val MIRRORS get() = arrayOf("6mh67.com", "qiximh3.com")
val MIRROR_NAMES get() = arrayOf("6漫画", "七夕漫画") val MIRROR_NAMES get() = arrayOf("6漫画", "七夕漫画")
private val isNewDateLogic = AppInfo.getVersionCode() >= 81
private val dateFormat by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) } private val dateFormat by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) }
} }
} }

View File

@ -6,7 +6,7 @@ ext {
extName = 'Terra Historicus' extName = 'Terra Historicus'
pkgNameSuffix = 'zh.terrahistoricus' pkgNameSuffix = 'zh.terrahistoricus'
extClass = '.TerraHistoricus' extClass = '.TerraHistoricus'
extVersionCode = 2 extVersionCode = 3
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.extension.zh.terrahistoricus package eu.kanade.tachiyomi.extension.zh.terrahistoricus
import eu.kanade.tachiyomi.AppInfo
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -57,23 +56,11 @@ data class THComic(
} }
} }
}.apply { }.apply {
if (isNewDateLogic) { this[0].date_upload = (updateTime ?: 0L) * 1000
this[0].date_upload = (updateTime ?: 0L) * 1000
}
} }
companion object { companion object {
private val EPISODE_TYPES = arrayOf("", "正篇", "番外", "贺图", "公告") private val EPISODE_TYPES = arrayOf("", "正篇", "番外", "贺图", "公告")
private val isNewDateLogic = run {
val commitCount = AppInfo.getVersionName().substringAfter('-', "")
if (commitCount.isNotEmpty()) {
// Preview
commitCount.toInt() >= 4442
} else {
// Stable
AppInfo.getVersionCode() >= 81
}
}
} }
} }