fix(Netflix): correct video range and codec validation logic

- Adjust condition order in video range and codec compatibility check
- Change range membership check from object to name string in profile loop
- Remove redundant error logging and sys.exit call in profile handling
- Improve consistency of video profile retrieval based on codec and range
This commit is contained in:
2025-08-30 11:37:31 +07:00
parent 33ceed0016
commit 0d2237d09a

View File

@@ -395,7 +395,7 @@ class Netflix(Service):
if self.vcodec.extension.upper() not in self.config["profiles"]["video"]: if self.vcodec.extension.upper() not in self.config["profiles"]["video"]:
raise ValueError(f"Video Codec {self.vcodec} is not supported by Netflix") raise ValueError(f"Video Codec {self.vcodec} is not supported by Netflix")
if self.range[0].name not in list(self.config["profiles"]["video"][self.vcodec.extension.upper()].keys()) and self.vcodec != Video.Codec.AVC and self.vcodec != Video.Codec.VP9 and self.range[0] != Video.Range.HYBRID: if self.range[0].name not in list(self.config["profiles"]["video"][self.vcodec.extension.upper()].keys()) and self.range[0] != Video.Range.HYBRID and self.vcodec != Video.Codec.AVC and self.vcodec != Video.Codec.VP9:
self.log.error(f"Video range {self.range[0].name} is not supported by Video Codec: {self.vcodec}") self.log.error(f"Video range {self.range[0].name} is not supported by Video Codec: {self.vcodec}")
sys.exit(1) sys.exit(1)
@@ -464,13 +464,10 @@ class Netflix(Service):
return result_profiles return result_profiles
for profiles in self.config["profiles"]["video"][self.vcodec.extension.upper()]: for profiles in self.config["profiles"]["video"][self.vcodec.extension.upper()]:
for range in self.range: for range in self.range:
if range in profiles: if range.name in profiles:
result_profiles.extend(self.config["profiles"]["video"][self.vcodec.extension.upper()][range.name]) result_profiles.extend(self.config["profiles"]["video"][self.vcodec.extension.upper()][range.name])
elif range == Video.Range.HYBRID: elif range == Video.Range.HYBRID:
result_profiles.extend(self.config["profiles"]["video"][self.vcodec.extension.upper()]["HDR10"]) result_profiles.extend(self.config["profiles"]["video"][self.vcodec.extension.upper()]["HDR10"])
else:
self.log.error(f" - {range} is not supported by {self.vcodec}")
sys.exit(1)
self.log.debug(f"Result_profiles: {result_profiles}") self.log.debug(f"Result_profiles: {result_profiles}")
return result_profiles return result_profiles