From dafbfb3017e8d7b5b2e06093a70f1c7584ff8400 Mon Sep 17 00:00:00 2001 From: Frank Epperlein Date: Sat, 21 Sep 2024 20:46:29 +0200 Subject: [PATCH] skip failed subtitle downloads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … and show a warning instead. Fix #95 --- mtv_dl.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mtv_dl.py b/mtv_dl.py index 8ad5d8c..ac4c23e 100755 --- a/mtv_dl.py +++ b/mtv_dl.py @@ -1201,9 +1201,13 @@ def download( if include_subtitles and self.show["url_subtitles"]: logger.debug("Downloading subtitles for %s from %r.", self.label, self.show["url_subtitles"]) - subtitles_xml_path = next(iter(self._download_files(temp_path, [self.show["url_subtitles"]]))) - subtitles_srt_path = self._convert_subtitles_xml_to_srt(subtitles_xml_path) - self._move_to_user_target(subtitles_srt_path, cwd, target, show_file_name, ".srt", "subtitles") + try: + subtitles_xml_path = next(iter(self._download_files(temp_path, [self.show["url_subtitles"]]))) + except urllib.error.HTTPError: + logger.warning("Missing subtitles for %s.", self.label) + else: + subtitles_srt_path = self._convert_subtitles_xml_to_srt(subtitles_xml_path) + self._move_to_user_target(subtitles_srt_path, cwd, target, show_file_name, ".srt", "subtitles") if include_nfo: root_node = "movie" if not series_mode else "episodedetails"