From 3900b57a167e39b9d208034d9fa864a2f07a800d Mon Sep 17 00:00:00 2001 From: chrisk325 Date: Sat, 14 Mar 2026 03:07:00 +0530 Subject: [PATCH] fix for edge case anime ids imdb+kitsu --- src/hooks/useMetadata.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hooks/useMetadata.ts b/src/hooks/useMetadata.ts index 34e4c60f..c42d29ac 100644 --- a/src/hooks/useMetadata.ts +++ b/src/hooks/useMetadata.ts @@ -2016,16 +2016,18 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat } if (__DEV__) console.log('✅ [loadEpisodeStreams] Converted to TMDB ID:', tmdbId); - // Ensure consistent format - // Ensure consistent format or fallback to episodeId if parsing failed - // This handles cases where 'tt' is used for a unique episode ID directly + // Ensure consistent format or fallback to episodeId if parsing failed. + // If the episode's namespace differs from the show's tt id (e.g. kitsu:48363:8 + // on a tt-identified show), use showIdStr so we request via the correct namespace. if (!seasonNum && !episodeNum) { stremioEpisodeId = episodeId; } else if (!seasonNum) { - // No season (e.g., mal:57658:1) - use id:episode format - stremioEpisodeId = `${id}:${episodeNum}`; + // No season (e.g., kitsu:48363:8, mal:57658:1) + 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] Normalized episode ID for addons:', stremioEpisodeId); } else {