diff --git a/src/hooks/useMetadata.ts b/src/hooks/useMetadata.ts index 291c8293..fa6c0707 100644 --- a/src/hooks/useMetadata.ts +++ b/src/hooks/useMetadata.ts @@ -125,9 +125,15 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat // Normalize anime subtypes to their base types for all internal logic. // anime.series behaves like series; anime.movie behaves like movie. - const normalizedType = type === 'anime.series' ? 'series' - : type === 'anime.movie' ? 'movie' - : type; + // Lowercase first — some addons use capitalized types (e.g. "Movie", "Series", "Other") + // which would break all type comparisons downstream. + const lowercasedType = type ? type.toLowerCase() : type; + + // Normalize anime subtypes to their base types for all internal logic. + // anime.series behaves like series; anime.movie behaves like movie. + const normalizedType = lowercasedType === 'anime.series' ? 'series' + : lowercasedType === 'anime.movie' ? 'movie' + : lowercasedType; const [metadata, setMetadata] = useState(null); const [loading, setLoading] = useState(true); diff --git a/src/services/catalog/search.ts b/src/services/catalog/search.ts index b20a3af0..08ca0cac 100644 --- a/src/services/catalog/search.ts +++ b/src/services/catalog/search.ts @@ -321,9 +321,19 @@ async function searchAddonCatalog( const items = metas.map(meta => { const content = convertMetaToStreamingContent(meta, library); - content.addonId = manifest.id; - if (type && content.type !== type) { - content.type = type; + const addonSupportsMeta = Array.isArray(manifest.resources) && manifest.resources.some((resource: any) => + resource === 'meta' || (typeof resource === 'object' && resource?.name === 'meta') + ); + + if (addonSupportsMeta) { + content.addonId = manifest.id; + } + + const normalizedCatalogType = type ? type.toLowerCase() : type; + if (normalizedCatalogType && content.type !== normalizedCatalogType) { + content.type = normalizedCatalogType; + } else if (content.type) { + content.type = content.type.toLowerCase(); } return content; }); diff --git a/src/services/catalogService.ts b/src/services/catalogService.ts index 2cfce314..4e194767 100644 --- a/src/services/catalogService.ts +++ b/src/services/catalogService.ts @@ -104,7 +104,7 @@ class CatalogService implements CatalogLibraryState { return getCatalogByType(this.library, dataSourcePreference, type, genreFilter); } - async getDataSourcePreference() { + async getDataSourcePreference(): Promise { return getDataSourcePreference(); }