@@ -16,9 +16,11 @@ export function presentStreamCandidate(stream = {}, metadata = {}, provider = {}
1616 descriptionParts . push ( originalDescription ) ;
1717 }
1818
19+ // TMDB (or another shared factual metadata resolver) fills sparse/Unknown provider
20+ // descriptions. It supplements facts only; it never invents stream provenance.
1921 const tmdbTitle = useful ( metadata . title ?? metadata . name ?? metadata . originalTitle ?? metadata . original_name ) ;
2022 const tmdbYear = positiveInt ( metadata . year ?? yearFromDate ( metadata . releaseDate ?? metadata . release_date ?? metadata . firstAirDate ?? metadata . first_air_date ) ) ;
21- if ( ! descriptionParts . length && ( tmdbTitle || tmdbYear ) ) {
23+ if ( ! originalDescription && ( tmdbTitle || tmdbYear ) ) {
2224 descriptionParts . push ( [ tmdbTitle , tmdbYear ] . filter ( Boolean ) . join ( " • " ) ) ;
2325 }
2426
@@ -92,8 +94,10 @@ export function normalizeSourceType(value) {
9294 if ( / W E B - ? R I P / . test ( compact ) ) return "WEBRIP" ;
9395 if ( / H D T V / . test ( compact ) ) return "HDTV" ;
9496 if ( / D V D R I P | D V D / . test ( compact ) ) return "DVD" ;
95- if ( / C A M | T S | T E L E S Y N C / . test ( compact ) ) return "CAM" ;
96- return text . toUpperCase ( ) ;
97+ if ( / (?: ^ | - ) C A M (?: - | $ ) | T E L E S Y N C / . test ( compact ) ) return "CAM" ;
98+ // Unknown strings are not provenance. In particular, a quality such as 1080p
99+ // must never be converted into a source badge or used to imply Blu-ray/Web-DL.
100+ return null ;
97101}
98102
99103export function normalizeCodec ( value ) {
@@ -140,7 +144,7 @@ export function normalizeAgeRating(value) {
140144 const upper = text . toUpperCase ( ) ;
141145 const france = upper . match ( / (?: - | I N T E R D I T \s + M O I N S \s + D E \s + ) ( 1 0 | 1 2 | 1 6 | 1 8 ) \b / ) ;
142146 if ( france ) return `-${ france [ 1 ] } ` ;
143- const plus = upper . match ( / \b ( 7 | 1 0 | 1 2 | 1 3 | 1 4 | 1 5 | 1 6 | 1 7 | 1 8 ) \+ \b / ) ;
147+ const plus = upper . match ( / (?: ^ | \b ) ( 7 | 1 0 | 1 2 | 1 3 | 1 4 | 1 5 | 1 6 | 1 7 | 1 8 ) \+ (?: $ | \s ) / ) ;
144148 if ( plus ) return `${ plus [ 1 ] } +` ;
145149 if ( / ^ (?: U | G | P G | P G - 1 3 | R | N C - 1 7 | T V - Y | T V - Y 7 | T V - G | T V - P G | T V - 1 4 | T V - M A ) $ / i. test ( text ) ) return upper ;
146150 return text ;
0 commit comments