diff --git a/unshackle/core/downloaders/n_m3u8dl_re.py b/unshackle/core/downloaders/n_m3u8dl_re.py index 52ea3be..7472c59 100644 --- a/unshackle/core/downloaders/n_m3u8dl_re.py +++ b/unshackle/core/downloaders/n_m3u8dl_re.py @@ -142,6 +142,12 @@ def get_track_selection_args(track: Any) -> list[str]: parts.append(f"lang={lang}") return _create_args("-ss", parts, "subtitle", extra_args=["--auto-subtitle-fix", "false"]) + case "URL": + raise ValueError( + f"[N_m3u8DL-RE]: Direct URL downloads are not supported for {track_type} tracks. " + f"The track should use a different downloader (e.g., 'requests', 'aria2c')." + ) + raise ValueError(f"[N_m3u8DL-RE]: Unsupported manifest type: {descriptor}") diff --git a/unshackle/core/tracks/track.py b/unshackle/core/tracks/track.py index 6cf12c9..0b1a38f 100644 --- a/unshackle/core/tracks/track.py +++ b/unshackle/core/tracks/track.py @@ -211,17 +211,21 @@ class Track: save_path = config.directories.temp / f"{track_type}_{self.id}.mp4" if track_type == "Subtitle": save_path = save_path.with_suffix(f".{self.codec.extension}") - # n_m3u8dl_re doesn't support directly downloading subtitles - if self.downloader.__name__ == "n_m3u8dl_re" and get_extension(self.url) in { - ".srt", - ".vtt", - ".ttml", - ".ssa", - ".ass", - ".stpp", - ".wvtt", - ".xml", - }: + # n_m3u8dl_re doesn't support directly downloading subtitles from URLs + # or when the subtitle has a direct file extension + if self.downloader.__name__ == "n_m3u8dl_re" and ( + self.descriptor == self.Descriptor.URL + or get_extension(self.url) in { + ".srt", + ".vtt", + ".ttml", + ".ssa", + ".ass", + ".stpp", + ".wvtt", + ".xml", + } + ): self.downloader = requests if self.descriptor != self.Descriptor.URL: