From 72b953b39e17e9289160fa8ae8df3f374bcb1436 Mon Sep 17 00:00:00 2001 From: chrisk325 Date: Fri, 13 Mar 2026 19:12:17 +0530 Subject: [PATCH] fix for anime ids tvdb+kitsu --- src/hooks/useMetadata.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hooks/useMetadata.ts b/src/hooks/useMetadata.ts index fc41f662..3cd92db8 100644 --- a/src/hooks/useMetadata.ts +++ b/src/hooks/useMetadata.ts @@ -2029,12 +2029,17 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat // Remove 'series:' prefix if present to be safe, though parsing logic above usually handles it stremioEpisodeId = episodeId.replace(/^series:/, ''); } else if (!seasonNum) { - // No season (e.g., mal:57658:1) - use id:episode format - stremioEpisodeId = `${id}:${episodeNum}`; + // No season (e.g., kitsu:12345:1, mal:57658:1) - use showIdStr:episode format. + // Use showIdStr (parsed from episodeId) rather than outer `id` so that when the + // show has multiple IDs (e.g. tvdb+kitsu), we preserve the namespace that the + // episode actually belongs to (e.g. kitsu:animeId:epNum, not tvdb:showId:epNum). + const baseId = showIdStr && showIdStr !== id ? showIdStr : id; + stremioEpisodeId = `${baseId}:${episodeNum}`; } else { - stremioEpisodeId = `${id}:${seasonNum}:${episodeNum}`; + const baseId = showIdStr && showIdStr !== id ? showIdStr : id; + stremioEpisodeId = `${baseId}:${seasonNum}:${episodeNum}`; } - if (__DEV__) console.log('ℹ️ [loadEpisodeStreams] Using ID as both TMDB and Stremio ID:', tmdbId); + if (__DEV__) console.log('ℹ️ [loadEpisodeStreams] Using ID as both TMDB and Stremio ID:', tmdbId, '| stremioEpisodeId:', stremioEpisodeId); } // Extract episode info from the episodeId for logging