Merge pull request #415 from tapframe/revert-406-patch-9

Revert "fix tmdb enrichment overriding addon provided metadata even when turned off"
This commit is contained in:
Nayif 2026-01-17 17:32:39 +05:30 committed by GitHub
commit 696d37dd08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -823,9 +823,6 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
// Store addon logo before TMDB enrichment overwrites it // Store addon logo before TMDB enrichment overwrites it
const addonLogo = (finalMetadata as any).logo; const addonLogo = (finalMetadata as any).logo;
const addonName = finalMetadata.name;
const addonDescription = finalMetadata.description;
const addonBanner = finalMetadata.banner;
try { try {
@ -860,8 +857,8 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
finalMetadata = { finalMetadata = {
...finalMetadata, ...finalMetadata,
name: (addonName && addonName.trim()) ? addonName : (localized.title || finalMetadata.name), name: localized.title || finalMetadata.name,
description: (addonDescription && addonDescription.trim()) ? addonDescription : (localized.overview || finalMetadata.description), description: localized.overview || finalMetadata.description,
movieDetails: movieDetailsObj, movieDetails: movieDetailsObj,
...(productionInfo.length > 0 && { networks: productionInfo }), ...(productionInfo.length > 0 && { networks: productionInfo }),
}; };
@ -897,8 +894,8 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
finalMetadata = { finalMetadata = {
...finalMetadata, ...finalMetadata,
name: (addonName && addonName.trim()) ? addonName : (localized.name || finalMetadata.name), name: localized.name || finalMetadata.name,
description: (addonDescription && addonDescription.trim()) ? addonDescription : (localized.overview || finalMetadata.description), description: localized.overview || finalMetadata.description,
tvDetails, tvDetails,
...(productionInfo.length > 0 && { networks: productionInfo }), ...(productionInfo.length > 0 && { networks: productionInfo }),
}; };
@ -930,7 +927,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
if (tmdbIdForLogo) { if (tmdbIdForLogo) {
const logoUrl = await tmdbService.getContentLogo(contentType, tmdbIdForLogo, preferredLanguage); const logoUrl = await tmdbService.getContentLogo(contentType, tmdbIdForLogo, preferredLanguage);
// Use TMDB logo if found, otherwise fall back to addon logo // Use TMDB logo if found, otherwise fall back to addon logo
finalMetadata.logo = addonLogo || logoUrl || undefined; finalMetadata.logo = logoUrl || addonLogo || undefined;
if (__DEV__) { if (__DEV__) {
console.log('[useMetadata] Logo fetch result:', { console.log('[useMetadata] Logo fetch result:', {
contentType, contentType,
@ -970,15 +967,12 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
} }
// Clear banner field if TMDB banner enrichment is enabled to prevent flash // Clear banner field if TMDB banner enrichment is enabled to prevent flash
if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichBanners) { if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichBanners && !finalMetadata.banner) {
if (!addonBanner && !finalMetadata.banner) { finalMetadata = {
finalMetadata = { ...finalMetadata,
...finalMetadata, banner: undefined, // Let useMetadataAssets handle banner via TMDB
banner: undefined,
// Let useMetadataAssets handle banner via TMDB
}; };
} }
}
// Preserve existing collection if it was set by fetchProductionInfo // Preserve existing collection if it was set by fetchProductionInfo
setMetadata((prev) => { setMetadata((prev) => {