mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
Merge pull request #331 from chrisk325/main
fixed tmdb enrichment logic , fixed trakt not syncing watch progress for old seasons
This commit is contained in:
commit
2b802079a0
5 changed files with 42 additions and 14 deletions
|
|
@ -114,6 +114,10 @@ export function useFeaturedContent() {
|
|||
};
|
||||
|
||||
try {
|
||||
if (base.logo && !isTmdbUrl(base.logo)) {
|
||||
return base;
|
||||
}
|
||||
|
||||
if (!settings.enrichMetadataWithTMDB) {
|
||||
return { ...base, logo: base.logo || undefined };
|
||||
}
|
||||
|
|
@ -150,6 +154,7 @@ export function useFeaturedContent() {
|
|||
id: item.id,
|
||||
type: item.type,
|
||||
name: item.name,
|
||||
addonId: item.addonId,
|
||||
poster: item.poster,
|
||||
banner: (item as any).banner,
|
||||
logo: (item as any).logo || undefined,
|
||||
|
|
|
|||
|
|
@ -857,8 +857,8 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
|||
|
||||
finalMetadata = {
|
||||
...finalMetadata,
|
||||
name: localized.title || finalMetadata.name,
|
||||
description: localized.overview || finalMetadata.description,
|
||||
name: finalMetadata.name || localized.title,
|
||||
description: finalMetadata.description || localized.overview,
|
||||
movieDetails: movieDetailsObj,
|
||||
...(productionInfo.length > 0 && { networks: productionInfo }),
|
||||
};
|
||||
|
|
@ -894,8 +894,8 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
|||
|
||||
finalMetadata = {
|
||||
...finalMetadata,
|
||||
name: localized.name || finalMetadata.name,
|
||||
description: localized.overview || finalMetadata.description,
|
||||
name: finalMetadata.name || localized.name,
|
||||
description: finalMetadata.description || localized.overview,
|
||||
tvDetails,
|
||||
...(productionInfo.length > 0 && { networks: productionInfo }),
|
||||
};
|
||||
|
|
@ -970,7 +970,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
|||
}
|
||||
|
||||
// Clear banner field if TMDB banner enrichment is enabled to prevent flash
|
||||
if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichBanners) {
|
||||
if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichBanners && !finalMetadata.banner) {
|
||||
finalMetadata = {
|
||||
...finalMetadata,
|
||||
banner: undefined, // Let useMetadataAssets handle banner via TMDB
|
||||
|
|
|
|||
|
|
@ -177,17 +177,17 @@ export const useMetadataAssets = (
|
|||
// Only update if request wasn't aborted and component is still mounted
|
||||
if (!isMountedRef.current) return;
|
||||
|
||||
if (details?.backdrop_path) {
|
||||
if (metadata?.banner) {
|
||||
finalBanner = metadata.banner;
|
||||
bannerSourceType = 'default';
|
||||
} else if (details?.backdrop_path) {
|
||||
finalBanner = tmdbService.getImageUrl(details.backdrop_path);
|
||||
bannerSourceType = 'tmdb';
|
||||
|
||||
// Preload the image
|
||||
if (finalBanner) {
|
||||
FastImage.preload([{ uri: finalBanner }]);
|
||||
}
|
||||
} else {
|
||||
// TMDB has no backdrop, gracefully fall back
|
||||
finalBanner = metadata?.banner || bannerImage || null;
|
||||
finalBanner = bannerImage || null;
|
||||
bannerSourceType = 'default';
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -269,4 +269,4 @@ export const useMetadataAssets = (
|
|||
logoLoadError: false,
|
||||
setLogoLoadError: () => { },
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -521,9 +521,10 @@ export function useTraktIntegration() {
|
|||
|
||||
try {
|
||||
// Fetch both playback progress and recently watched movies
|
||||
const [traktProgress, watchedMovies] = await Promise.all([
|
||||
const [traktProgress, watchedMovies, watchedShows] = await Promise.all([
|
||||
getTraktPlaybackProgress(),
|
||||
traktService.getWatchedMovies()
|
||||
traktService.getWatchedShows()
|
||||
]);
|
||||
|
||||
// Progress retrieval logging removed
|
||||
|
|
@ -593,6 +594,28 @@ export function useTraktIntegration() {
|
|||
logger.error('[useTraktIntegration] Error preparing watched movie update:', error);
|
||||
}
|
||||
}
|
||||
for (const show of watchedShows) {
|
||||
try {
|
||||
if (show.show?.ids?.imdb && show.seasons) {
|
||||
const showImdbId = show.show.ids.imdb;
|
||||
|
||||
for (const season of show.seasons) {
|
||||
for (const episode of season.episodes) {
|
||||
const episodeId = `${showImdbId}:${season.number}:${episode.number}`;
|
||||
updatePromises.push(
|
||||
storageService.mergeWithTraktProgress(
|
||||
showImdbId,
|
||||
'series',
|
||||
100,
|
||||
episode.last_watched_at,
|
||||
episodeId
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('[useTraktIntegration] Error preparing watched show update:', error);
|
||||
|
||||
// Execute all updates in parallel
|
||||
await Promise.all(updatePromises);
|
||||
|
|
@ -698,4 +721,4 @@ export function useTraktIntegration() {
|
|||
isInWatchlist,
|
||||
isInCollection
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ export const useStreamsScreen = () => {
|
|||
episodeId: (type === 'series' || type === 'other') && selectedEpisode ? selectedEpisode : undefined,
|
||||
imdbId: imdbId || undefined,
|
||||
availableStreams: streamsToPass,
|
||||
backdrop: bannerImage || metadata?.banner,
|
||||
backdrop: metadata?.banner || bannerImage,
|
||||
videoType,
|
||||
} as any);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue