mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 09:01:43 +00:00
Fix issue with overwriting files
This commit is contained in:
parent
c55256c5a3
commit
b9d973bef1
@ -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.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']
|
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_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('autonumber', '--auto-number', '-o "%(autonumber)s-%(title)s.%(ext)s"')
|
||||||
check_deprecated('usetitle', '--title', '-o "%(title)s-%(id)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'))
|
'info.json', ie_result.get('ext'))
|
||||||
if not ensure_dir_exists(encodeFilename(infofn)):
|
if not ensure_dir_exists(encodeFilename(infofn)):
|
||||||
return
|
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')
|
self.to_screen('[info] Playlist metadata is already present')
|
||||||
else:
|
else:
|
||||||
self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
|
self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
|
||||||
|
@ -332,7 +332,7 @@ def download(self, filename, info_dict, subtitle=False):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
nooverwrites_and_exists = (
|
nooverwrites_and_exists = (
|
||||||
not self.params.get('overwrites', True)
|
not self.params.get('overwrites', subtitle)
|
||||||
and os.path.exists(encodeFilename(filename))
|
and os.path.exists(encodeFilename(filename))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user