mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-07-31 16:49:28 +00:00
fix: apply tv/series alias and singular resource name to subtitle addon matching
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
521ba187f4
commit
1b7c9d6481
1 changed files with 3 additions and 2 deletions
|
|
@ -101,7 +101,7 @@ object SubtitleRepository {
|
|||
}
|
||||
|
||||
_addonSubtitles.value = allSubs
|
||||
if (allSubs.isEmpty() && addons.any { it.manifest?.resources?.any { r -> r.name == "subtitles" } == true }) {
|
||||
if (allSubs.isEmpty() && addons.any { it.manifest?.resources?.any { r -> r.name.isSubtitleResourceName() } == true }) {
|
||||
_error.value = getString(Res.string.compose_player_no_subtitles_found)
|
||||
}
|
||||
_isLoading.value = false
|
||||
|
|
@ -123,7 +123,8 @@ private fun String.isSubtitleResourceName(): Boolean =
|
|||
equals("subtitles", ignoreCase = true) || equals("subtitle", ignoreCase = true)
|
||||
|
||||
private fun AddonResource.supportsSubtitleType(type: String, videoId: String): Boolean {
|
||||
val typeMatches = types.isEmpty() || types.any { it.equals(type, ignoreCase = true) }
|
||||
val canonical = canonicalSubtitleType(type)
|
||||
val typeMatches = types.isEmpty() || types.any { canonicalSubtitleType(it).equals(canonical, ignoreCase = true) }
|
||||
if (!typeMatches) return false
|
||||
return idPrefixes.isEmpty() || idPrefixes.any { prefix -> videoId.startsWith(prefix) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue