mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-11 20:40:42 +00:00
fixed tmdb enrichment logic overrding addons meta while turned off.
This commit is contained in:
parent
b6a5c108de
commit
5fe23c7ad1
2 changed files with 28 additions and 14 deletions
|
|
@ -824,9 +824,9 @@ 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;
|
||||||
|
|
||||||
// If localization is enabled AND title/description enrichment is enabled, merge TMDB localized text (name/overview) before first render
|
|
||||||
try {
|
try {
|
||||||
if (settings.enrichMetadataWithTMDB && settings.useTmdbLocalizedMetadata && settings.tmdbEnrichTitleDescription) {
|
if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichTitleDescription) {
|
||||||
const tmdbSvc = TMDBService.getInstance();
|
const tmdbSvc = TMDBService.getInstance();
|
||||||
let finalTmdbId: number | null = tmdbId;
|
let finalTmdbId: number | null = tmdbId;
|
||||||
if (!finalTmdbId) {
|
if (!finalTmdbId) {
|
||||||
|
|
@ -835,7 +835,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalTmdbId) {
|
if (finalTmdbId) {
|
||||||
const lang = settings.tmdbLanguagePreference || 'en';
|
const lang = settings.useTmdbLocalizedMetadata ? (settings.tmdbLanguagePreference || 'en') : 'en';
|
||||||
if (type === 'movie') {
|
if (type === 'movie') {
|
||||||
const localized = await tmdbSvc.getMovieDetails(String(finalTmdbId), lang);
|
const localized = await tmdbSvc.getMovieDetails(String(finalTmdbId), lang);
|
||||||
if (localized) {
|
if (localized) {
|
||||||
|
|
@ -904,7 +904,7 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (__DEV__) console.log('[useMetadata] failed to merge localized TMDB text', e);
|
if (__DEV__) console.log('[useMetadata] failed to merge TMDB title/description', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Centralized logo fetching logic
|
// Centralized logo fetching logic
|
||||||
|
|
@ -1149,13 +1149,11 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
||||||
if (__DEV__) logger.log('[loadSeriesData] TMDB season poster enrichment disabled; skipping season poster fetch');
|
if (__DEV__) logger.log('[loadSeriesData] TMDB season poster enrichment disabled; skipping season poster fetch');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If localized TMDB text is enabled AND episode enrichment is enabled, merge episode names/overviews per language
|
if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichEpisodes) {
|
||||||
if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichEpisodes && settings.useTmdbLocalizedMetadata) {
|
|
||||||
try {
|
try {
|
||||||
const tmdbIdToUse = tmdbId || (id.startsWith('tt') ? await tmdbService.findTMDBIdByIMDB(id) : null);
|
const tmdbIdToUse = tmdbId || (id.startsWith('tt') ? await tmdbService.findTMDBIdByIMDB(id) : null);
|
||||||
if (tmdbIdToUse) {
|
if (tmdbIdToUse) {
|
||||||
// Use just the language code (e.g., 'ar', not 'ar-US') for TMDB API
|
const lang = settings.useTmdbLocalizedMetadata ? (settings.tmdbLanguagePreference || 'en') : 'en';
|
||||||
const lang = settings.tmdbLanguagePreference || 'en';
|
|
||||||
const seasons = Object.keys(groupedAddonEpisodes).map(Number);
|
const seasons = Object.keys(groupedAddonEpisodes).map(Number);
|
||||||
|
|
||||||
// Fetch all seasons in parallel (much faster than fetching each episode individually)
|
// Fetch all seasons in parallel (much faster than fetching each episode individually)
|
||||||
|
|
@ -1187,10 +1185,10 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(seasonPromises);
|
await Promise.all(seasonPromises);
|
||||||
if (__DEV__) logger.log('[useMetadata] merged localized episode names/overviews from TMDB (batch)');
|
if (__DEV__) logger.log('[useMetadata] merged episode names/overviews from TMDB (batch)');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (__DEV__) console.log('[useMetadata] failed to merge localized episode text', e);
|
if (__DEV__) console.log('[useMetadata] failed to merge episode text from TMDB', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1159,7 +1159,11 @@ class CatalogService {
|
||||||
const metas = await stremioService.getCatalog(manifest, type, catalog.id, 1, filters);
|
const metas = await stremioService.getCatalog(manifest, type, catalog.id, 1, filters);
|
||||||
|
|
||||||
if (metas && metas.length > 0) {
|
if (metas && metas.length > 0) {
|
||||||
const items = metas.slice(0, limit).map(meta => this.convertMetaToStreamingContent(meta));
|
const items = metas.slice(0, limit).map(meta => {
|
||||||
|
const content = this.convertMetaToStreamingContent(meta);
|
||||||
|
content.addonId = addon.id;
|
||||||
|
return content;
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
addonName: addon.name,
|
addonName: addon.name,
|
||||||
items
|
items
|
||||||
|
|
@ -1226,7 +1230,11 @@ class CatalogService {
|
||||||
const metas = await stremioService.getCatalog(manifest, type, catalogId, page, filters);
|
const metas = await stremioService.getCatalog(manifest, type, catalogId, page, filters);
|
||||||
|
|
||||||
if (metas && metas.length > 0) {
|
if (metas && metas.length > 0) {
|
||||||
return metas.map(meta => this.convertMetaToStreamingContent(meta));
|
return metas.map(meta => {
|
||||||
|
const content = this.convertMetaToStreamingContent(meta);
|
||||||
|
content.addonId = addonId;
|
||||||
|
return content;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -1257,7 +1265,11 @@ class CatalogService {
|
||||||
const metas = await stremioService.getCatalog(manifest, catalog.type, catalog.id, 1, filters);
|
const metas = await stremioService.getCatalog(manifest, catalog.type, catalog.id, 1, filters);
|
||||||
|
|
||||||
if (metas && metas.length > 0) {
|
if (metas && metas.length > 0) {
|
||||||
const items = metas.map(meta => this.convertMetaToStreamingContent(meta));
|
const items = metas.map(meta => {
|
||||||
|
const content = this.convertMetaToStreamingContent(meta);
|
||||||
|
content.addonId = addon.id;
|
||||||
|
return content;
|
||||||
|
});
|
||||||
results.push(...items);
|
results.push(...items);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -1519,7 +1531,11 @@ class CatalogService {
|
||||||
const metas = response.data?.metas || [];
|
const metas = response.data?.metas || [];
|
||||||
|
|
||||||
if (metas.length > 0) {
|
if (metas.length > 0) {
|
||||||
const items = metas.map(meta => this.convertMetaToStreamingContent(meta));
|
const items = metas.map(meta => {
|
||||||
|
const content = this.convertMetaToStreamingContent(meta);
|
||||||
|
content.addonId = addon.id;
|
||||||
|
return content;
|
||||||
|
});
|
||||||
logger.log(`Found ${items.length} results from ${addon.name}`);
|
logger.log(`Found ${items.length} results from ${addon.name}`);
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue