@@ -23,8 +23,6 @@ const { touchUserLastSeen } = require('../utils/userActivity');
2323
2424const router = Router ( ) ;
2525
26- const TMDB_POSTER_BASE = 'https://image.tmdb.org/t/p/w500' ;
27-
2826// ─── Auth Helper ──────────────────────────────────────────────────────────────
2927
3028/**
@@ -81,27 +79,14 @@ function toStremioType(csType) {
8179
8280/**
8381 * Build a lightweight CloudStream search/catalog result item from a VOD row.
84- * Mirrors the ID logic in addonHandler's buildMetaPreview().
82+ * CloudStream should stay provider-scoped, so it always uses the internal
83+ * sb_<id> form rather than TMDB/IMDb IDs.
8584 */
8685function buildCSItem ( item ) {
87- // Live channels are resolved per-provider row (not via TMDB), so always use
88- // the sb_<id> form for them. Movies/series prefer the TMDB/IMDB ID so
89- // handleMeta can aggregate streams across providers.
90- const isLive = item . vod_type === 'live' ;
91- const hasMatch = ! isLive && item . tmdb_id != null ;
92-
93- const url = hasMatch
94- ? ( item . imdb_id || `tmdb:${ item . tmdb_id } ` )
95- : `sb_${ item . id } ` ;
96-
97- const posterUrl = hasMatch && item . poster_path
98- ? `${ TMDB_POSTER_BASE } ${ item . poster_path } `
99- : ( item . poster_url || null ) ;
100-
10186 return {
10287 name : item . raw_title || 'Unknown' ,
103- url,
104- posterUrl,
88+ url : `sb_ ${ item . id } ` ,
89+ posterUrl : item . poster_url || null ,
10590 type : toCSType ( item . vod_type ) ,
10691 year : item . title_year || null ,
10792 tags : item . category ? [ item . category ] : [ ] ,
@@ -367,13 +352,13 @@ router.get('/search', async (req, res) => {
367352
368353/**
369354 * Returns full detail for a single item, including the episode list for series.
370- * Delegates to addonHandler.handleMeta() so it reuses all caching, TMDB
371- * enrichment, and EPG logic already in place .
355+ * Delegates to addonHandler.handleMeta() using the provider-scoped sb_<id>
356+ * identifier emitted by CloudStream catalog/search responses .
372357 *
373358 * Query params:
374359 * token – addon token (required)
375360 * url – content ID from a catalog/search result (required)
376- * type – 'Movie' | 'TvSeries' | 'Live' (required for correct TMDB lookup)
361+ * type – 'Movie' | 'TvSeries' | 'Live'
377362 *
378363 * Response:
379364 * { name, url, posterUrl, type, year, plot, tags, episodes? }
0 commit comments