From dae83b0bd5c83aba2a643fd6535bc132b887fdb7 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sun, 14 Apr 2024 02:31:31 +0100 Subject: [PATCH] fix(Video): Ensure track is supported in change_color_range() --- devine/core/tracks/video.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/devine/core/tracks/video.py b/devine/core/tracks/video.py index 80c29b9..0ce6e50 100644 --- a/devine/core/tracks/video.py +++ b/devine/core/tracks/video.py @@ -177,7 +177,14 @@ class Video(Track): def change_color_range(self, range_: int) -> None: """Change the Video's Color Range to Limited (0) or Full (1).""" 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") if not executable: