aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-02-07 16:47:48 +0530
committerpukkandan <pukkandan@gmail.com>2021-02-07 17:41:41 +0530
commit8a0b9322580e6691ee2f137a679120df2eb838d5 (patch)
treecf396ba29cf63d749f28fba8bfe94bb1c204fdd5
parent4d608b522f7f05c7dbc4b74e6183e93cc95d6a0c (diff)
downloadhypervideo-pre-8a0b9322580e6691ee2f137a679120df2eb838d5.tar.lz
hypervideo-pre-8a0b9322580e6691ee2f137a679120df2eb838d5.tar.xz
hypervideo-pre-8a0b9322580e6691ee2f137a679120df2eb838d5.zip
[movefiles] Fix compatibility with python2
:ci skip dl
-rw-r--r--.gitignore4
-rw-r--r--youtube_dlc/postprocessor/movefilesafterdownload.py10
-rw-r--r--youtube_dlc/utils.py2
3 files changed, 9 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index c48bdb89c..73288053d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,6 +58,10 @@ youtube-dlc
*.ogg
*.opus
*.info.json
+*.live_chat.json
+*.jpg
+*.png
+*.webp
*.annotations.xml
*.description
diff --git a/youtube_dlc/postprocessor/movefilesafterdownload.py b/youtube_dlc/postprocessor/movefilesafterdownload.py
index 7f34ac5c5..fa61317ed 100644
--- a/youtube_dlc/postprocessor/movefilesafterdownload.py
+++ b/youtube_dlc/postprocessor/movefilesafterdownload.py
@@ -4,11 +4,11 @@ import shutil
from .common import PostProcessor
from ..utils import (
+ decodeFilename,
encodeFilename,
make_dir,
PostProcessingError,
)
-from ..compat import compat_str
class MoveFilesAfterDownloadPP(PostProcessor):
@@ -26,12 +26,12 @@ class MoveFilesAfterDownloadPP(PostProcessor):
finaldir = info.get('__finaldir', dl_path)
finalpath = os.path.join(finaldir, dl_name)
self.files_to_move.update(info['__files_to_move'])
- self.files_to_move[info['filepath']] = finalpath
+ self.files_to_move[info['filepath']] = decodeFilename(finalpath)
+ make_newfilename = lambda old: decodeFilename(os.path.join(finaldir, os.path.basename(encodeFilename(old))))
for oldfile, newfile in self.files_to_move.items():
if not newfile:
- newfile = os.path.join(finaldir, os.path.basename(encodeFilename(oldfile)))
- oldfile, newfile = compat_str(oldfile), compat_str(newfile)
+ newfile = make_newfilename(oldfile)
if os.path.abspath(encodeFilename(oldfile)) == os.path.abspath(encodeFilename(newfile)):
continue
if not os.path.exists(encodeFilename(oldfile)):
@@ -50,5 +50,5 @@ class MoveFilesAfterDownloadPP(PostProcessor):
self.to_screen('Moving file "%s" to "%s"' % (oldfile, newfile))
shutil.move(oldfile, newfile) # os.rename cannot move between volumes
- info['filepath'] = compat_str(finalpath)
+ info['filepath'] = finalpath
return [], info
diff --git a/youtube_dlc/utils.py b/youtube_dlc/utils.py
index 987f4bcc0..79a0f6a63 100644
--- a/youtube_dlc/utils.py
+++ b/youtube_dlc/utils.py
@@ -4690,9 +4690,7 @@ def cli_configuration_args(params, arg_name, key, default=[], exe=None): # retu
return default, False
assert isinstance(argdict, dict)
- assert isinstance(key, compat_str)
key = key.lower()
-
args = exe_args = None
if exe is not None:
assert isinstance(exe, compat_str)