Skip to content

Commit

Permalink
skip failed subtitle downloads
Browse files Browse the repository at this point in the history
… and show a warning instead.

Fix #95
  • Loading branch information
fnep committed Sep 21, 2024
1 parent 7ecd97a commit dafbfb3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mtv_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit dafbfb3

Please sign in to comment.