use the series id of upNextSeries to select the current season and only fall back to preferred local if not found
This commit is contained in:
parent
8bdaa8122b
commit
a95813e91e
|
@ -257,7 +257,7 @@ data class Seasons(
|
|||
@SerialName("total") val total: Int,
|
||||
@SerialName("items") val items: List<Season>
|
||||
) {
|
||||
fun getPreferredSeason(local: Locale): Season {
|
||||
fun getPreferredSeasonByLocal(local: Locale): Season {
|
||||
return items.firstOrNull { season ->
|
||||
// try to get the the first seasons which matches the preferred local
|
||||
season.slugTitle.endsWith("${local.getDisplayLanguage(Locale.ENGLISH)}-dub", true)
|
||||
|
|
|
@ -57,10 +57,11 @@ class MediaFragmentViewModel(application: Application) : AndroidViewModel(applic
|
|||
viewModelScope.launch { similarTo = Crunchyroll.similarTo(crunchyId) }
|
||||
).joinAll()
|
||||
|
||||
// TODO use upNextSeries to find the next item to play, maybe fallback to preferredLocale
|
||||
// load the preferred season (preferred language, language per season, not per stream)
|
||||
currentSeasonCrunchy = seasonsCrunchy.getPreferredSeason(Preferences.preferredLocale)
|
||||
|
||||
// load the preferred season:
|
||||
// next episode > preferred language (language per season, not per stream)
|
||||
currentSeasonCrunchy = seasonsCrunchy.items.firstOrNull{ season ->
|
||||
season.id == upNextSeries.panel.episodeMetadata.seasonId
|
||||
} ?: seasonsCrunchy.getPreferredSeasonByLocal(Preferences.preferredLocale)
|
||||
// Note: if we need to query metaDB, do it now
|
||||
|
||||
// load episodes and metaDB in parallel (tmdb needs mediaType, which is set via episodes)
|
||||
|
|
Loading…
Reference in New Issue