aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-05-16 15:47:54 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-05-16 15:47:56 +0200
commitf07b74fc18aac210c60ee8b8cb29b5b43b0eb780 (patch)
tree5bfef1ce1984de3ca53fa1cbad07e048d09c327b /youtube_dl/utils.py
parentbeee53de06eca52d0ae042ce6fcabf319180ec14 (diff)
[ffmpeg] Correct argument encoding on Windows with Python 2.x
Fixes #2924
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index aa9347f43..b97e62ae9 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -540,6 +540,16 @@ def encodeFilename(s, for_subprocess=False):
encoding = 'utf-8'
return s.encode(encoding, 'ignore')
+
+def encodeArgument(s):
+ if not isinstance(s, compat_str):
+ # Legacy code that uses byte strings
+ # Uncomment the following line after fixing all post processors
+ #assert False, 'Internal error: %r should be of type %r, is %r' % (s, compat_str, type(s))
+ s = s.decode('ascii')
+ return encodeFilename(s, True)
+
+
def decodeOption(optval):
if optval is None:
return optval