Comick: Better first cover selection (#6399)
* Better first cover selection * Reformat * Deduplication of conditions
This commit is contained in:
parent
c66131c809
commit
90ffe087db
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Comick'
|
extName = 'Comick'
|
||||||
extClass = '.ComickFactory'
|
extClass = '.ComickFactory'
|
||||||
extVersionCode = 49
|
extVersionCode = 50
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -396,17 +396,16 @@ abstract class Comick(
|
||||||
val coversUrl =
|
val coversUrl =
|
||||||
"$apiUrl/comic/${mangaData.comic.slug ?: mangaData.comic.hid}/covers?tachiyomi=true"
|
"$apiUrl/comic/${mangaData.comic.slug ?: mangaData.comic.hid}/covers?tachiyomi=true"
|
||||||
val covers = client.newCall(GET(coversUrl)).execute()
|
val covers = client.newCall(GET(coversUrl)).execute()
|
||||||
.parseAs<Covers>().mdCovers.reversed().toMutableList()
|
.parseAs<Covers>().mdCovers.reversed()
|
||||||
if (covers.any { it.vol == "1" }) covers.retainAll { it.vol == "1" }
|
val firstVol = covers.filter { it.vol == "1" }.ifEmpty { covers }
|
||||||
if (
|
val originalCovers = firstVol
|
||||||
covers.any { it.locale == comickLang.split('-').first() }
|
.filter { mangaData.comic.isoLang.orEmpty().startsWith(it.locale.orEmpty()) }
|
||||||
) {
|
val localCovers = firstVol
|
||||||
covers.retainAll { it.locale == comickLang.split('-').first() }
|
.filter { comickLang.startsWith(it.locale.orEmpty()) }
|
||||||
}
|
|
||||||
return mangaData.toSManga(
|
return mangaData.toSManga(
|
||||||
includeMuTags = preferences.includeMuTags,
|
includeMuTags = preferences.includeMuTags,
|
||||||
scorePosition = preferences.scorePosition,
|
scorePosition = preferences.scorePosition,
|
||||||
covers = covers,
|
covers = localCovers.ifEmpty { originalCovers }.ifEmpty { firstVol },
|
||||||
groupTags = preferences.groupTags,
|
groupTags = preferences.groupTags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -467,7 +466,8 @@ abstract class Comick(
|
||||||
.map { it.toSChapter(mangaUrl) }
|
.map { it.toSChapter(mangaUrl) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val publishedDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH).apply {
|
private val publishedDateFormat =
|
||||||
|
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH).apply {
|
||||||
timeZone = TimeZone.getTimeZone("UTC")
|
timeZone = TimeZone.getTimeZone("UTC")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ class Comic(
|
||||||
@SerialName("md_comic_md_genres") val mdGenres: List<MdGenres>,
|
@SerialName("md_comic_md_genres") val mdGenres: List<MdGenres>,
|
||||||
@SerialName("mu_comics") val muGenres: MuComicCategories = MuComicCategories(emptyList()),
|
@SerialName("mu_comics") val muGenres: MuComicCategories = MuComicCategories(emptyList()),
|
||||||
@SerialName("bayesian_rating") val score: String? = null,
|
@SerialName("bayesian_rating") val score: String? = null,
|
||||||
|
@SerialName("iso639_1") val isoLang: String? = null,
|
||||||
) {
|
) {
|
||||||
val origination = when (country) {
|
val origination = when (country) {
|
||||||
"jp" -> Name("Manga")
|
"jp" -> Name("Manga")
|
||||||
|
|
Loading…
Reference in New Issue