From 1bf540d28b9a53112532aefde12188db5b327891 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 8 Feb 2021 15:48:12 +0530 Subject: [PATCH] [sponskrub] Don't raise error when the video does not exist Eg: `--convert-sub srt --no-download --sponskrub` gave error before :ci skip dl --- youtube_dlc/YoutubeDL.py | 2 +- youtube_dlc/postprocessor/sponskrub.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 890660745..92ca687a8 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -2349,7 +2349,7 @@ class YoutubeDL(object): downloaded.append(fname) partial_success, real_download = dl(fname, new_info) success = success and partial_success - info_dict['__postprocessors'] = postprocessors + info_dict['__postprocessors'].append(postprocessors) info_dict['__files_to_merge'] = downloaded # Even if there were no downloads, it is being merged only now info_dict['__real_download'] = True diff --git a/youtube_dlc/postprocessor/sponskrub.py b/youtube_dlc/postprocessor/sponskrub.py index 4e9bec257..0ba22138e 100644 --- a/youtube_dlc/postprocessor/sponskrub.py +++ b/youtube_dlc/postprocessor/sponskrub.py @@ -43,6 +43,10 @@ class SponSkrubPP(PostProcessor): if self.path is None: return [], information + filename = information['filepath'] + if not os.path.exists(encodeFilename(filename)): # no download + return [], information + if information['extractor_key'].lower() != 'youtube': self.to_screen('Skipping sponskrub since it is not a YouTube video') return [], information @@ -58,7 +62,6 @@ class SponSkrubPP(PostProcessor): if not information.get('__real_download', False): self.report_warning('If sponskrub is run multiple times, unintended parts of the video could be cut out.') - filename = information['filepath'] temp_filename = prepend_extension(filename, self._temp_ext) if os.path.exists(encodeFilename(temp_filename)): os.remove(encodeFilename(temp_filename))