Revert "streamscreen tvshow rendering fix"

This reverts commit 41adf5913f.
This commit is contained in:
tapframe 2026-01-20 19:37:25 +05:30
parent 2314d1db86
commit b817ff37b5
3 changed files with 10 additions and 19 deletions

View file

@ -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);

View file

@ -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;

View file

@ -1836,8 +1836,6 @@ class StremioService {
// Check if any installed addons can provide streams (including embedded streams in metadata)
async hasStreamProviders(type?: string): Promise<boolean> {
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;
}