diff --git a/src/components/home/AppleTVHero.tsx b/src/components/home/AppleTVHero.tsx index 509ae99..a4161a3 100644 --- a/src/components/home/AppleTVHero.tsx +++ b/src/components/home/AppleTVHero.tsx @@ -678,8 +678,8 @@ const AppleTVHero: React.FC = ({ banner: currentItem.banner, releaseInfo: currentItem.releaseInfo, genres: currentItem.genres - } - }; + } + }; // Add resume data if we have progress that's not near completion if (shouldResume && watchProgress) { diff --git a/src/components/home/ContinueWatchingSection.tsx b/src/components/home/ContinueWatchingSection.tsx index 5db6d71..f6f110f 100644 --- a/src/components/home/ContinueWatchingSection.tsx +++ b/src/components/home/ContinueWatchingSection.tsx @@ -997,14 +997,14 @@ const ContinueWatchingSection = React.forwardRef((props, re navigation.navigate('Streams', { id: item.id, type: item.type, - episodeId: episodeId + episodeId: episodeId, addonId: item.addonId }); } else { // For movies or series without specific episode, navigate to main content navigation.navigate('Streams', { id: item.id, - type: item.type + type: item.type, addonId: item.addonId }); } diff --git a/src/components/home/ThisWeekSection.tsx b/src/components/home/ThisWeekSection.tsx index 3992f02..da75ed9 100644 --- a/src/components/home/ThisWeekSection.tsx +++ b/src/components/home/ThisWeekSection.tsx @@ -196,37 +196,37 @@ export const ThisWeekSection = React.memo(() => { }, [calendarData]); const handleEpisodePress = (episode: ThisWeekEpisode) => { - // For grouped episodes, always go to series details - if (episode.isGroup) { - navigation.navigate('Metadata', { - id: episode.seriesId, - type: 'series', - addonId: episode.addonId, - }); - return; - } + // For grouped episodes, always go to series details + if (episode.isGroup) { + navigation.navigate('Metadata', { + id: episode.seriesId, + type: 'series', + addonId: episode.addonId, + }); + return; + } - // For upcoming episodes, go to the metadata screen - if (!episode.isReleased) { + // For upcoming episodes, go to the metadata screen + if (!episode.isReleased) { + const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; + navigation.navigate('Metadata', { + id: episode.seriesId, + type: 'series', + episodeId, + addonId: episode.addonId, + }); + return; + } + + // For released episodes, go to the streams screen const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; - navigation.navigate('Metadata', { + navigation.navigate('Streams', { id: episode.seriesId, type: 'series', episodeId, addonId: episode.addonId, }); - return; - } - - // For released episodes, go to the streams screen - const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; - navigation.navigate('Streams', { - id: episode.seriesId, - type: 'series', - episodeId, - addonId: episode.addonId, - }); -}; + }; const handleViewAll = () => { navigation.navigate('Calendar' as any); diff --git a/src/hooks/useCalendarData.ts b/src/hooks/useCalendarData.ts index 4d0a8e6..0c1ed8e 100644 --- a/src/hooks/useCalendarData.ts +++ b/src/hooks/useCalendarData.ts @@ -219,7 +219,7 @@ export const useCalendarData = (): UseCalendarDataReturn => { overview: tmdbEpisode.overview || '', vote_average: tmdbEpisode.vote_average || 0, still_path: tmdbEpisode.still_path || null, - season_poster_path: tmdbEpisode.season_poster_path || null + season_poster_path: tmdbEpisode.season_poster_path || null, addonId: series.addonId, }; @@ -246,7 +246,7 @@ export const useCalendarData = (): UseCalendarDataReturn => { overview: '', vote_average: 0, still_path: null, - season_poster_path: null + season_poster_path: null, addonId: series.addonId, } }; @@ -267,7 +267,7 @@ export const useCalendarData = (): UseCalendarDataReturn => { overview: '', vote_average: 0, still_path: null, - season_poster_path: null + season_poster_path: null, addonId: series.addonId, } }; diff --git a/src/navigation/AppNavigator.tsx b/src/navigation/AppNavigator.tsx index 061f140..11dcba1 100644 --- a/src/navigation/AppNavigator.tsx +++ b/src/navigation/AppNavigator.tsx @@ -123,6 +123,7 @@ export type RootStackParamList = { }; resumeTime?: number; duration?: number; + addonId?: string; }; PlayerIOS: { uri: string; diff --git a/src/services/catalogService.ts b/src/services/catalogService.ts index 869a7cb..3123cbe 100644 --- a/src/services/catalogService.ts +++ b/src/services/catalogService.ts @@ -88,7 +88,6 @@ export interface StreamingContent { imdb_id?: string; slug?: string; releaseInfo?: string; - addonId?: string; traktSource?: 'watchlist' | 'continue-watching' | 'watched'; addonCast?: Array<{ id: number; @@ -376,7 +375,7 @@ class CatalogService { if (metas && metas.length > 0) { // Cap items per catalog to reduce memory and rendering load const limited = metas.slice(0, 12); - const items = limited.map(meta => this.convertMetaToStreamingContent(meta)); + const items = limited.map(meta => this.convertMetaToStreamingContent(meta, addon.id)); // Get potentially custom display name; if customized, respect it as-is const originalName = catalog.name || catalog.id; @@ -468,7 +467,7 @@ class CatalogService { const metas = await stremioService.getCatalog(manifest, type, catalog.id, 1, filters); if (metas && metas.length > 0) { - const items = metas.map(meta => this.convertMetaToStreamingContent(meta)); + const items = metas.map(meta => this.convertMetaToStreamingContent(meta, addon.id)); // Get potentially custom display name const displayName = await getCatalogDisplayName(addon.id, catalog.type, catalog.id, catalog.name); @@ -705,7 +704,7 @@ class CatalogService { }); // Add to recent content using enhanced conversion for full metadata - const content = this.convertMetaToStreamingContentEnhanced(meta); + const content = this.convertMetaToStreamingContentEnhanced(meta, preferredAddonId); this.addToRecentContent(content); // Check if it's in the library @@ -799,7 +798,7 @@ class CatalogService { if (meta) { // Use basic conversion without enhanced metadata processing - const content = this.convertMetaToStreamingContent(meta); + const content = this.convertMetaToStreamingContent(meta, preferredAddonId); // Check if it's in the library content.inLibrary = this.library[`${type}:${id}`] !== undefined; @@ -818,7 +817,7 @@ class CatalogService { } } - private convertMetaToStreamingContent(meta: Meta): StreamingContent { + private convertMetaToStreamingContent(meta: Meta, addonId?: string): StreamingContent { // Basic conversion for catalog display - no enhanced metadata processing // Use addon's poster if available, otherwise use placeholder let posterUrl = meta.poster; @@ -853,7 +852,7 @@ class CatalogService { } // Enhanced conversion for detailed metadata (used only when fetching individual content details) - private convertMetaToStreamingContentEnhanced(meta: Meta): StreamingContent { + private convertMetaToStreamingContentEnhanced(meta: Meta, addonId?: string): StreamingContent { // Enhanced conversion to utilize all available metadata from addons const converted: StreamingContent = { id: meta.id, @@ -1239,10 +1238,10 @@ class CatalogService { const metas = await stremioService.getCatalog(manifest, type, catalogId, page, filters); if (metas && metas.length > 0) { - return metas.map(meta => ({ - ...this.convertMetaToStreamingContent(meta), - addonId: addonId - })); + return metas.map(meta => ({ + ...this.convertMetaToStreamingContent(meta), + addonId: addonId + })); } return []; } catch (error) { @@ -1537,7 +1536,7 @@ class CatalogService { if (metas.length > 0) { const items = metas.map(meta => ({ ...this.convertMetaToStreamingContent(meta), - addonId: addon.id + addonId: addon.id })); logger.log(`Found ${items.length} results from ${addon.name}`); return items;