Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,10 @@ class StreamRepository @Inject constructor(

private fun idMatchesAnyPrefix(id: String, prefixes: List<String>?): Boolean {
if (prefixes.isNullOrEmpty()) return true
val isStandardId = id.startsWith("tt", ignoreCase = true) ||
id.startsWith("tmdb:", ignoreCase = true) ||
id.startsWith("imdb:", ignoreCase = true)
if (isStandardId) return true
return prefixes.any { prefix ->
val normalizedPrefix = prefix.trim()
normalizedPrefix.isBlank() ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,17 @@ class StreamEpisodeRequestPlannerTest {

assertEquals(false, shouldFallback)
}

@Test
fun `buildEpisodeIdCandidates produces valid candidates for tmdb and imdb ids`() {
val candidates = buildEpisodeIdCandidates(
seriesId = "tmdb:82928:1:1",
animeQuery = null,
tmdbEpisodeId = null,
preferNativeAnimeIds = false
)

assertEquals(listOf("tmdb:82928:1:1"), candidates.map { it.contentId })
assertEquals(listOf("imdb"), candidates.map { it.label })
}
}
Loading