A feature-rich command-line audio/video downloader
Fix issue with overwriting files
pukkandanb9d973bef121
diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.pyindex 8aa0b7fbdf..50eaf235cb 100644--- a/youtube_dlc/YoutubeDL.py+++ b/youtube_dlc/YoutubeDL.py@@ -447,6 +447,9 @@ class YoutubeDL(object):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 @@ class YoutubeDL(object):'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.pyindex ff72f52d1b..f7e7955aae 100644--- a/youtube_dlc/downloader/common.py+++ b/youtube_dlc/downloader/common.py@@ -332,7 +332,7 @@ class FileDownloader(object):"""nooverwrites_and_exists = (- not self.params.get('overwrites', True)+ not self.params.get('overwrites', subtitle)and os.path.exists(encodeFilename(filename)))