refactor(Video): Return None if no m3u RANGE, not SDR

This commit is contained in:
rlaphoenix 2024-04-14 02:40:16 +01:00
parent 15d73be532
commit 23485bc820
1 changed files with 4 additions and 2 deletions

View File

@ -141,9 +141,11 @@ class Video(Track):
return Video.Range.SDR
@staticmethod
def from_m3u_range_tag(tag: str) -> Video.Range:
def from_m3u_range_tag(tag: str) -> Optional[Video.Range]:
tag = (tag or "").upper().replace('"', '').strip()
if not tag or tag == "SDR":
if not tag:
return None
if tag == "SDR":
return Video.Range.SDR
elif tag == "PQ":
return Video.Range.HDR10 # technically could be any PQ-transfer range