type:tv addon detection fix

This commit is contained in:
tapframe 2025-10-11 01:20:26 +05:30
parent fb316d9f37
commit 4e3c9c208f
3 changed files with 9 additions and 9 deletions

View file

@ -124,7 +124,7 @@ const ContinueWatchingSection = React.forwardRef<ContinueWatchingRef>((props, re
}
try {
const shouldFetchMeta = stremioService.isValidContentId(type, id);
const shouldFetchMeta = await stremioService.isValidContentId(type, id);
const [metadata, basicContent] = await Promise.all([
shouldFetchMeta ? stremioService.getMetaDetails(type, id) : Promise.resolve(null),
catalogService.getBasicContentDetails(type, id)

View file

@ -516,7 +516,7 @@ class CatalogService {
console.log(`🔍 [CatalogService] Attempt ${i + 1}/2 for getContentDetails:`, { type, id, preferredAddonId });
// Skip meta requests for non-content ids (e.g., provider slugs)
const isValidId = stremioService.isValidContentId(type, id);
const isValidId = await stremioService.isValidContentId(type, id);
console.log(`🔍 [CatalogService] Content ID validation:`, { type, id, isValidId });
if (!isValidId) {
@ -635,7 +635,7 @@ class CatalogService {
for (let i = 0; i < 3; i++) {
try {
// Skip meta requests for non-content ids (e.g., provider slugs)
if (!stremioService.isValidContentId(type, id)) {
if (!(await stremioService.isValidContentId(type, id))) {
break;
}
meta = await stremioService.getMetaDetails(type, id, preferredAddonId);

View file

@ -189,8 +189,8 @@ class StremioService {
}
// Dynamic validator for content IDs based on installed addon capabilities
public isValidContentId(type: string, id: string | null | undefined): boolean {
const isValidType = type === 'movie' || type === 'series';
public async isValidContentId(type: string, id: string | null | undefined): Promise<boolean> {
const isValidType = type === 'movie' || type === 'series' || type === 'tv';
const lowerId = (id || '').toLowerCase();
const isNullishId = !id || lowerId === 'null' || lowerId === 'undefined';
const providerLikeIds = new Set<string>(['moviebox', 'torbox']);
@ -198,6 +198,9 @@ class StremioService {
if (!isValidType || isNullishId || isProviderSlug) return false;
// Ensure addons are initialized before checking prefixes
await this.ensureInitialized();
// Get all supported ID prefixes from installed addons
const supportedPrefixes = this.getAllSupportedIdPrefixes(type);
@ -237,9 +240,6 @@ class StremioService {
}
}
// No hardcoded prefixes - let addons declare their own support dynamically
// If no addons declare prefixes, we'll allow any non-empty string
return Array.from(prefixes);
}
@ -766,7 +766,7 @@ class StremioService {
console.log(`🔍 [StremioService] getMetaDetails called:`, { type, id, preferredAddonId });
try {
// Validate content ID first
const isValidId = this.isValidContentId(type, id);
const isValidId = await this.isValidContentId(type, id);
console.log(`🔍 [StremioService] Content ID validation:`, { type, id, isValidId });
if (!isValidId) {