Do not encode outtmpl twice (Closes #5288)

This commit is contained in:
Sergey M․ 2015-04-04 00:30:37 +06:00
parent 16fa01291b
commit ff556f5c09
2 changed files with 2 additions and 5 deletions

View File

@ -189,10 +189,6 @@ def _real_main(argv=None):
if opts.allsubtitles and not opts.writeautomaticsub: if opts.allsubtitles and not opts.writeautomaticsub:
opts.writesubtitles = True opts.writesubtitles = True
if sys.version_info < (3,):
# In Python 2, sys.argv is a bytestring (also note http://bugs.python.org/issue2128 for Windows systems)
if opts.outtmpl is not None:
opts.outtmpl = opts.outtmpl.decode(preferredencoding())
outtmpl = ((opts.outtmpl is not None and opts.outtmpl) or outtmpl = ((opts.outtmpl is not None and opts.outtmpl) or
(opts.format == '-1' and opts.usetitle and '%(title)s-%(id)s-%(format)s.%(ext)s') or (opts.format == '-1' and opts.usetitle and '%(title)s-%(id)s-%(format)s.%(ext)s') or
(opts.format == '-1' and '%(id)s-%(format)s.%(ext)s') or (opts.format == '-1' and '%(id)s-%(format)s.%(ext)s') or

View File

@ -13,6 +13,7 @@
compat_kwargs, compat_kwargs,
) )
from .utils import ( from .utils import (
preferredencoding,
write_string, write_string,
) )
from .version import __version__ from .version import __version__
@ -797,7 +798,7 @@ def _hide_login_info(opts):
# Workaround for Python 2.x, where argv is a byte list # Workaround for Python 2.x, where argv is a byte list
if sys.version_info < (3,): if sys.version_info < (3,):
command_line_conf = [ command_line_conf = [
a.decode('utf-8', 'replace') for a in command_line_conf] a.decode(preferredencoding(), 'replace') for a in command_line_conf]
if '--ignore-config' in command_line_conf: if '--ignore-config' in command_line_conf:
system_conf = [] system_conf = []