fix(Video): Ensure track is supported in change_color_range()

This commit is contained in:
rlaphoenix 2024-04-14 02:31:31 +01:00
parent 20da213066
commit dae83b0bd5

View File

@ -177,7 +177,14 @@ class Video(Track):
def change_color_range(self, range_: int) -> None: def change_color_range(self, range_: int) -> None:
"""Change the Video's Color Range to Limited (0) or Full (1).""" """Change the Video's Color Range to Limited (0) or Full (1)."""
if not self.path or not self.path.exists(): if not self.path or not self.path.exists():
raise ValueError("Cannot repackage a Track that has not been downloaded.") raise ValueError("Cannot change the color range flag on a Video that has not been downloaded.")
if not self.codec:
raise ValueError("Cannot change the color range flag on a Video that has no codec specified.")
if self.codec not in (Video.Codec.AVC, Video.Codec.HEVC):
raise NotImplementedError(
"Cannot change the color range flag on this Video as "
f"it's codec, {self.codec.value}, is not yet supported."
)
executable = get_binary_path("ffmpeg") executable = get_binary_path("ffmpeg")
if not executable: if not executable: