From b9d973bef1217561801f3f6b4074ad880ddc424e Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 1 Feb 2021 20:45:46 +0530 Subject: [PATCH] Fix issue with overwriting files --- youtube_dlc/YoutubeDL.py | 5 ++++- youtube_dlc/downloader/common.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 8aa0b7fbdf..50eaf235cb 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -447,6 +447,9 @@ def check_deprecated(param, option, suggestion): self.report_warning('--merge-output-format will be ignored since --remux-video or --recode-video is given') self.params['merge_output_format'] = self.params['final_ext'] + if 'overwrites' in self.params and self.params['overwrites'] is None: + del self.params['overwrites'] + check_deprecated('autonumber_size', '--autonumber-size', 'output template with %(autonumber)0Nd, where N in the number of digits') check_deprecated('autonumber', '--auto-number', '-o "%(autonumber)s-%(title)s.%(ext)s"') check_deprecated('usetitle', '--title', '-o "%(title)s-%(id)s.%(ext)s"') @@ -1130,7 +1133,7 @@ def ensure_dir_exists(path): 'info.json', ie_result.get('ext')) if not ensure_dir_exists(encodeFilename(infofn)): return - if self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)): + if not self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)): self.to_screen('[info] Playlist metadata is already present') else: self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn) diff --git a/youtube_dlc/downloader/common.py b/youtube_dlc/downloader/common.py index ff72f52d1b..f7e7955aae 100644 --- a/youtube_dlc/downloader/common.py +++ b/youtube_dlc/downloader/common.py @@ -332,7 +332,7 @@ def download(self, filename, info_dict, subtitle=False): """ nooverwrites_and_exists = ( - not self.params.get('overwrites', True) + not self.params.get('overwrites', subtitle) and os.path.exists(encodeFilename(filename)) )