mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
Fix --force-overwrites
when using -k
For formats that need merge, the `.fxxx` files are not removed before downloading the corresponding `.part` files. This causes the rename to fail
This commit is contained in:
parent
b714b41f81
commit
f775c83110
1 changed files with 5 additions and 2 deletions
|
@ -204,9 +204,12 @@ def ytdl_filename(self, filename):
|
||||||
return filename + '.ytdl'
|
return filename + '.ytdl'
|
||||||
|
|
||||||
def try_rename(self, old_filename, new_filename):
|
def try_rename(self, old_filename, new_filename):
|
||||||
|
if old_filename == new_filename:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
if old_filename == new_filename:
|
if self.params.get('overwrites', False):
|
||||||
return
|
if os.path.isfile(encodeFilename(new_filename)):
|
||||||
|
os.remove(encodeFilename(new_filename))
|
||||||
os.rename(encodeFilename(old_filename), encodeFilename(new_filename))
|
os.rename(encodeFilename(old_filename), encodeFilename(new_filename))
|
||||||
except (IOError, OSError) as err:
|
except (IOError, OSError) as err:
|
||||||
self.report_error('unable to rename file: %s' % error_to_compat_str(err))
|
self.report_error('unable to rename file: %s' % error_to_compat_str(err))
|
||||||
|
|
Loading…
Reference in a new issue