From b817ff37b5b2528f4e22b4f3a815b0886695aeb8 Mon Sep 17 00:00:00 2001 From: tapframe <85391825+tapframe@users.noreply.github.com> Date: Tue, 20 Jan 2026 19:37:25 +0530 Subject: [PATCH] Revert "streamscreen tvshow rendering fix" This reverts commit 41adf5913f96207a2f0dabd95d7a0d39d3776960. --- src/hooks/useMetadata.ts | 14 ++++---------- src/screens/streams/useStreamsScreen.ts | 3 +-- src/services/stremioService.ts | 12 +++++------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/hooks/useMetadata.ts b/src/hooks/useMetadata.ts index 3b1bc7b8..751e8c83 100644 --- a/src/hooks/useMetadata.ts +++ b/src/hooks/useMetadata.ts @@ -1537,9 +1537,6 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat const allStremioAddons = await stremioService.getInstalledAddons(); const localScrapers = await localScraperService.getInstalledScrapers(); - // Map app-level "tv" type to Stremio "series" for addon capability checks - const stremioType = type === 'tv' ? 'series' : type; - // Filter Stremio addons to only include those that provide streams for this content type const streamAddons = allStremioAddons.filter(addon => { if (!addon.resources || !Array.isArray(addon.resources)) { @@ -1555,7 +1552,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat const typedResource = resource as any; if (typedResource.name === 'stream' && Array.isArray(typedResource.types) && - typedResource.types.includes(stremioType)) { + typedResource.types.includes(type)) { hasStreamResource = true; // Check if this addon supports the ID prefix generically: any prefix must match start of id @@ -1570,7 +1567,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat } // Check if the element is the simple string "stream" AND the addon has a top-level types array else if (typeof resource === 'string' && resource === 'stream' && addon.types) { - if (Array.isArray(addon.types) && addon.types.includes(stremioType)) { + if (Array.isArray(addon.types) && addon.types.includes(type)) { hasStreamResource = true; // For simple string resources, check addon-level idPrefixes generically if (addon.idPrefixes && Array.isArray(addon.idPrefixes) && addon.idPrefixes.length > 0) { @@ -1638,9 +1635,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat // Start Stremio request using the converted ID format if (__DEV__) console.log('🎬 [loadStreams] Using ID for Stremio addons:', stremioId); - // Map app-level "tv" type to Stremio "series" when requesting streams - const stremioContentType = type === 'tv' ? 'series' : type; - processStremioSource(stremioContentType, stremioId, false); + processStremioSource(type, stremioId, false); // Also extract any embedded streams from metadata (PPV-style addons) extractEmbeddedStreams(); @@ -1918,8 +1913,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat // For collections, treat episodes as individual movies, not series // For other types (e.g. StreamsPPV), preserve the original type unless it's explicitly 'series' logic we want - // Map app-level "tv" type to Stremio "series" for addon stream endpoint - const contentType = isCollection ? 'movie' : (type === 'tv' ? 'series' : type); + const contentType = isCollection ? 'movie' : type; if (__DEV__) console.log(`🎬 [loadEpisodeStreams] Using content type: ${contentType} for ${isCollection ? 'collection' : type}`); processStremioSource(contentType, stremioEpisodeId, true); diff --git a/src/screens/streams/useStreamsScreen.ts b/src/screens/streams/useStreamsScreen.ts index de3299b1..90164c11 100644 --- a/src/screens/streams/useStreamsScreen.ts +++ b/src/screens/streams/useStreamsScreen.ts @@ -678,8 +678,7 @@ export const useStreamsScreen = () => { hasDoneInitialLoadRef.current = true; try { - const stremioType = type === 'tv' ? 'series' : type; - const hasStremioProviders = await stremioService.hasStreamProviders(stremioType); + const hasStremioProviders = await stremioService.hasStreamProviders(type); const hasLocalScrapers = settings.enableLocalScrapers && (await localScraperService.hasScrapers()); const hasProviders = hasStremioProviders || hasLocalScrapers; diff --git a/src/services/stremioService.ts b/src/services/stremioService.ts index d0b10283..65d129c9 100644 --- a/src/services/stremioService.ts +++ b/src/services/stremioService.ts @@ -1836,8 +1836,6 @@ class StremioService { // Check if any installed addons can provide streams (including embedded streams in metadata) async hasStreamProviders(type?: string): Promise { await this.ensureInitialized(); - // App-level content type "tv" maps to Stremio "series" - const normalizedType = type === 'tv' ? 'series' : type; const addons = Array.from(this.installedAddons.values()); for (const addon of addons) { @@ -1851,12 +1849,12 @@ class StremioService { if (hasStreamResource) { // If type specified, also check if addon supports this type - if (normalizedType) { - const supportsType = addon.types?.includes(normalizedType) || + if (type) { + const supportsType = addon.types?.includes(type) || addon.resources.some(resource => typeof resource === 'object' && (resource as any).name === 'stream' && - (resource as any).types?.includes(normalizedType) + (resource as any).types?.includes(type) ); if (supportsType) return true; } else { @@ -1866,14 +1864,14 @@ class StremioService { // Also check for addons with meta resource that support the type // These addons might provide embedded streams within metadata - if (normalizedType) { + if (type) { const hasMetaResource = addon.resources.some(resource => typeof resource === 'string' ? resource === 'meta' : (resource as any).name === 'meta' ); - if (hasMetaResource && addon.types?.includes(normalizedType)) { + if (hasMetaResource && addon.types?.includes(type)) { // This addon provides meta for the type - might have embedded streams return true; }