mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 10:22:47 +01:00
Comick: Fix permanently cached First Cover URLs and Score on Description (#5686)
* Remove permanent cache of First Cover URL Because images can be replaced or even removed altogether * Reuse preference default constants for `.toSManga` parameters * Score on description was removed at some point? * Filter covers earlier and try to narrow it down further by language * Reformat long line * Don't assume a default cover language * Only use country code part of language code * Reformat for Lint complainer
This commit is contained in:
parent
05e0ae3e4b
commit
8fb7f92aca
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'Comick'
|
||||
extClass = '.ComickFactory'
|
||||
extVersionCode = 47
|
||||
extVersionCode = 48
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,11 @@ abstract class Comick(
|
||||
is TagFilter -> {
|
||||
if (it.state.isNotEmpty()) {
|
||||
it.state.split(",").forEach {
|
||||
addQueryParameter("tags", it.trim().lowercase().replace(SPACE_AND_SLASH_REGEX, "-").replace("'-", "-and-039-").replace("'", "-and-039-"))
|
||||
addQueryParameter(
|
||||
"tags",
|
||||
it.trim().lowercase().replace(SPACE_AND_SLASH_REGEX, "-")
|
||||
.replace("'-", "-and-039-").replace("'", "-and-039-"),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,29 +376,26 @@ abstract class Comick(
|
||||
private fun mangaDetailsParse(response: Response, manga: SManga): SManga {
|
||||
val mangaData = response.parseAs<Manga>()
|
||||
if (!preferences.updateCover && manga.thumbnail_url != mangaData.comic.cover) {
|
||||
if (manga.thumbnail_url.toString().endsWith("#1")) {
|
||||
return mangaData.toSManga(
|
||||
includeMuTags = preferences.includeMuTags,
|
||||
scorePosition = preferences.scorePosition,
|
||||
covers = listOf(
|
||||
MDcovers(
|
||||
b2key = manga.thumbnail_url?.substringBeforeLast("#")
|
||||
?.substringAfterLast("/"),
|
||||
vol = "1",
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
val coversUrl =
|
||||
"$apiUrl/comic/${mangaData.comic.slug ?: mangaData.comic.hid}/covers?tachiyomi=true"
|
||||
val covers = client.newCall(GET(coversUrl)).execute()
|
||||
.parseAs<Covers>().mdCovers.reversed()
|
||||
.parseAs<Covers>().mdCovers.reversed().toMutableList()
|
||||
if (covers.any { it.vol == "1" }) covers.retainAll { it.vol == "1" }
|
||||
if (
|
||||
covers.any { it.locale == comickLang.split('-').first() }
|
||||
) {
|
||||
covers.retainAll { it.locale == comickLang.split('-').first() }
|
||||
}
|
||||
return mangaData.toSManga(
|
||||
includeMuTags = preferences.includeMuTags,
|
||||
covers = if (covers.any { it.vol == "1" }) covers.filter { it.vol == "1" } else covers,
|
||||
scorePosition = preferences.scorePosition,
|
||||
covers = covers,
|
||||
)
|
||||
}
|
||||
return mangaData.toSManga(includeMuTags = preferences.includeMuTags)
|
||||
return mangaData.toSManga(
|
||||
includeMuTags = preferences.includeMuTags,
|
||||
scorePosition = preferences.scorePosition,
|
||||
)
|
||||
}
|
||||
|
||||
override fun getMangaUrl(manga: SManga): String {
|
||||
@ -511,12 +512,12 @@ abstract class Comick(
|
||||
private val SPACE_AND_SLASH_REGEX = Regex("[ /]")
|
||||
private const val IGNORED_GROUPS_PREF = "IgnoredGroups"
|
||||
private const val INCLUDE_MU_TAGS_PREF = "IncludeMangaUpdatesTags"
|
||||
private const val INCLUDE_MU_TAGS_DEFAULT = false
|
||||
const val INCLUDE_MU_TAGS_DEFAULT = false
|
||||
private const val MIGRATED_IGNORED_GROUPS = "MigratedIgnoredGroups"
|
||||
private const val FIRST_COVER_PREF = "DefaultCover"
|
||||
private const val FIRST_COVER_DEFAULT = true
|
||||
private const val SCORE_POSITION_PREF = "ScorePosition"
|
||||
private const val SCORE_POSITION_DEFAULT = "top"
|
||||
const val SCORE_POSITION_DEFAULT = "top"
|
||||
private const val LIMIT = 20
|
||||
private const val CHAPTERS_LIMIT = 99999
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package eu.kanade.tachiyomi.extension.all.comickfun
|
||||
|
||||
import eu.kanade.tachiyomi.extension.all.comickfun.Comick.Companion.INCLUDE_MU_TAGS_DEFAULT
|
||||
import eu.kanade.tachiyomi.extension.all.comickfun.Comick.Companion.SCORE_POSITION_DEFAULT
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import kotlinx.serialization.SerialName
|
||||
@ -31,8 +33,8 @@ class Manga(
|
||||
private val demographic: String? = null,
|
||||
) {
|
||||
fun toSManga(
|
||||
includeMuTags: Boolean = false,
|
||||
scorePosition: String = "",
|
||||
includeMuTags: Boolean = INCLUDE_MU_TAGS_DEFAULT,
|
||||
scorePosition: String = SCORE_POSITION_DEFAULT,
|
||||
covers: List<MDcovers>? = null,
|
||||
) =
|
||||
SManga.create().apply {
|
||||
@ -148,6 +150,7 @@ class Covers(
|
||||
class MDcovers(
|
||||
val b2key: String?,
|
||||
val vol: String? = null,
|
||||
val locale: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
Loading…
Reference in New Issue
Block a user