1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-12-30 03:21:31 +00:00

[WIP] got refactor of file mover basically working

This commit is contained in:
Kieran Eglin
2024-04-24 09:47:58 -07:00
parent fe4a15ff75
commit 44bb6c2056
3 changed files with 188 additions and 71 deletions

View File

@@ -2099,7 +2099,9 @@ def prepend_extension(filename, ext, expected_real_ext=None):
def replace_extension(filename, ext, expected_real_ext=None):
name, real_ext = os.path.splitext(filename)
return '{}.{}'.format(
ext = ext if ext.startswith('.') else '.' + ext
return '{}{}'.format(
name if not expected_real_ext or real_ext[1:] == expected_real_ext else filename,
ext)