Skip to content
Closed
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 @@ -188,7 +188,8 @@ internal fun usesSlowAggregatorTimeout(addon: Addon): Boolean {
haystack.contains("aio-streams") ||
haystack.contains("comet") ||
haystack.contains("mediafusion") ||
haystack.contains("hdhub")
haystack.contains("hdhub") ||
haystack.contains("pengu")
}

/**
Expand Down Expand Up @@ -1428,7 +1429,12 @@ class StreamRepository @Inject constructor(
genreIds: List<Int>,
originalLanguage: String?
): List<Addon> {
val seriesAddons = getStreamAddons(addons, "series", imdbId)
val seriesAddons = buildList {
addAll(getStreamAddons(addons, "series", imdbId))
if (tmdbId != null) {
addAll(getStreamAddons(addons, "series", "tmdb:$tmdbId"))
}
}.distinctBy { it.id }
val hasNativeAnimeAddon = addons.any(::shouldPreferNativeAnimeIds)
val shouldIncludeAnimeAddons = isAnime ||
shouldTryNativeAnimeFallback(
Expand All @@ -1451,7 +1457,7 @@ class StreamRepository @Inject constructor(
// debrid-backed addons (Torrentio, MediaFusion, etc.) that resolve remotely.
private val ADDON_TIMEOUT_MS = 6_000L
private val ADDON_EPISODE_TIMEOUT_MS = 10_000L
private val ADDON_SINGLE_STREAM_REQUEST_TIMEOUT_MS = 4_000L
private val ADDON_SINGLE_STREAM_REQUEST_TIMEOUT_MS = 8_000L
private val ADDON_NATIVE_ANIME_EPISODE_TIMEOUT_MS = 24_000L
private val ADDON_NATIVE_ANIME_SINGLE_STREAM_REQUEST_TIMEOUT_MS = 12_000L
private val ANIME_ID_LOOKUP_TIMEOUT_MS = 3_000L
Expand Down Expand Up @@ -1850,7 +1856,7 @@ class StreamRepository @Inject constructor(
return emptyList()
}

val tmdbEpisodeId = if (resolveAsAnime && tmdbId != null && addonSupportsIdFamily(addon, "tmdb")) {
val tmdbEpisodeId = if (tmdbId != null && addonSupportsIdFamily(addon, "tmdb")) {
"tmdb:$tmdbId:$season:$episode"
} else null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ class StreamEpisodeRequestPlannerTest {
assertEquals(listOf("imdb", "kitsu", "tmdb"), candidates.map { it.label })
}

@Test
fun `generic series without anime query includes tmdb episode candidate`() {
val candidates = buildEpisodeIdCandidates(
seriesId = "tt9054364:1:2",
animeQuery = null,
tmdbEpisodeId = "tmdb:82684:1:2",
preferNativeAnimeIds = false
)

assertEquals(
listOf("tt9054364:1:2", "tmdb:82684:1:2"),
candidates.map { it.contentId }
)
assertEquals(listOf("imdb", "tmdb"), candidates.map { it.label })
}

@Test
fun `native anime addons can skip ambiguous tmdb episode ids`() {
val candidates = buildEpisodeIdCandidates(
Expand Down
Loading