aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/postprocessor/movefilesafterdownload.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/postprocessor/movefilesafterdownload.py')
-rw-r--r--yt_dlp/postprocessor/movefilesafterdownload.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/yt_dlp/postprocessor/movefilesafterdownload.py b/yt_dlp/postprocessor/movefilesafterdownload.py
index 35e87051b..964ca1f92 100644
--- a/yt_dlp/postprocessor/movefilesafterdownload.py
+++ b/yt_dlp/postprocessor/movefilesafterdownload.py
@@ -4,8 +4,6 @@ from .common import PostProcessor
from ..compat import shutil
from ..utils import (
PostProcessingError,
- decodeFilename,
- encodeFilename,
make_dir,
)
@@ -21,25 +19,25 @@ class MoveFilesAfterDownloadPP(PostProcessor):
return 'MoveFiles'
def run(self, info):
- dl_path, dl_name = os.path.split(encodeFilename(info['filepath']))
+ dl_path, dl_name = os.path.split(info['filepath'])
finaldir = info.get('__finaldir', dl_path)
finalpath = os.path.join(finaldir, dl_name)
if self._downloaded:
- info['__files_to_move'][info['filepath']] = decodeFilename(finalpath)
+ info['__files_to_move'][info['filepath']] = finalpath
- make_newfilename = lambda old: decodeFilename(os.path.join(finaldir, os.path.basename(encodeFilename(old))))
+ make_newfilename = lambda old: os.path.join(finaldir, os.path.basename(old))
for oldfile, newfile in info['__files_to_move'].items():
if not newfile:
newfile = make_newfilename(oldfile)
- if os.path.abspath(encodeFilename(oldfile)) == os.path.abspath(encodeFilename(newfile)):
+ if os.path.abspath(oldfile) == os.path.abspath(newfile):
continue
- if not os.path.exists(encodeFilename(oldfile)):
+ if not os.path.exists(oldfile):
self.report_warning(f'File "{oldfile}" cannot be found')
continue
- if os.path.exists(encodeFilename(newfile)):
+ if os.path.exists(newfile):
if self.get_param('overwrites', True):
self.report_warning(f'Replacing existing file "{newfile}"')
- os.remove(encodeFilename(newfile))
+ os.remove(newfile)
else:
self.report_warning(
f'Cannot move file "{oldfile}" out of temporary directory since "{newfile}" already exists. ')