fix(all/yomiroll): Make pref subtitle show up first in case app can't determine locale (#2850)

This commit is contained in:
Samfun75 2024-01-31 17:26:05 +03:00 committed by GitHub
parent d058cd77f8
commit 8ffc21113b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Yomiroll' extName = 'Yomiroll'
extClass = '.Yomiroll' extClass = '.Yomiroll'
extVersionCode = 29 extVersionCode = 30
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -188,7 +188,8 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
return info.data.first().toSAnimeOrNull(anime) ?: anime return info.data.first().toSAnimeOrNull(anime) ?: anime
} }
override fun animeDetailsParse(response: Response): SAnime = throw UnsupportedOperationException() override fun animeDetailsParse(response: Response): SAnime =
throw UnsupportedOperationException()
// ============================== Episodes ============================== // ============================== Episodes ==============================
@ -287,10 +288,8 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
val sub = json.decodeFromString<Subtitle>(value.jsonObject.toString()) val sub = json.decodeFromString<Subtitle>(value.jsonObject.toString())
Track(sub.url, sub.locale.getLocale()) Track(sub.url, sub.locale.getLocale())
}?.sortedWith( }?.sortedWith(
compareBy( compareByDescending<Track> { it.lang.contains(subLocale) }
{ it.lang }, .thenBy { it.lang },
{ it.lang.contains(subLocale) },
),
) )
}.getOrNull() ?: emptyList() }.getOrNull() ?: emptyList()
@ -355,7 +354,6 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
Pair("en-IN", "English (India)"), Pair("en-IN", "English (India)"),
Pair("es-419", "Spanish (América Latina)"), Pair("es-419", "Spanish (América Latina)"),
Pair("es-ES", "Spanish (España)"), Pair("es-ES", "Spanish (España)"),
Pair("es-LA", "Spanish (América Latina)"),
Pair("fr-FR", "French"), Pair("fr-FR", "French"),
Pair("ja-JP", "Japanese"), Pair("ja-JP", "Japanese"),
Pair("hi-IN", "Hindi"), Pair("hi-IN", "Hindi"),
@ -415,7 +413,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
} }
} ?: SAnime.UNKNOWN } ?: SAnime.UNKNOWN
author = content_provider author = content_provider
description = anime?.description ?: StringBuilder().apply { description = StringBuilder().apply {
appendLine(this@toSAnime.description) appendLine(this@toSAnime.description)
appendLine() appendLine()