__init__.py -> new --output format + warn if old
- Edited __init__.py so that it uses the new {NAME} rather than the old %(NAME)s --output format - Moved the backwards compatibility code from YoutubeDL.py to __init__.py - Display a warning if the old format is used
This commit is contained in:
parent
95d9e48547
commit
736c60eaa5
@ -546,8 +546,7 @@ class YoutubeDL(object):
|
|||||||
autonumber_size = self.params.get('autonumber_size')
|
autonumber_size = self.params.get('autonumber_size')
|
||||||
if autonumber_size is None:
|
if autonumber_size is None:
|
||||||
autonumber_size = 5
|
autonumber_size = 5
|
||||||
autonumber_templ = '%0' + str(autonumber_size) + 'd'
|
template_dict['autonumber'] = '%0*d' % (autonumber_size, self._num_downloads)
|
||||||
template_dict['autonumber'] = autonumber_templ % self._num_downloads
|
|
||||||
if template_dict.get('playlist_index') is not None:
|
if template_dict.get('playlist_index') is not None:
|
||||||
template_dict['playlist_index'] = '%0*d' % (len(str(template_dict['n_entries'])), template_dict['playlist_index'])
|
template_dict['playlist_index'] = '%0*d' % (len(str(template_dict['n_entries'])), template_dict['playlist_index'])
|
||||||
if template_dict.get('resolution') is None:
|
if template_dict.get('resolution') is None:
|
||||||
@ -568,10 +567,7 @@ class YoutubeDL(object):
|
|||||||
template_dict = collections.defaultdict(lambda: 'NA', template_dict)
|
template_dict = collections.defaultdict(lambda: 'NA', template_dict)
|
||||||
|
|
||||||
outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
|
outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
|
||||||
tmpl = compat_expanduser(outtmpl)
|
filename = sanitize_path(string.Formatter().vformat(outtmpl, None, template_dict))
|
||||||
# Backwards compatibility fix (deprecated): %(foo)s -> {foo}, %% -> %
|
|
||||||
tmpl = re.sub(r'(?<!%)((?:%)*)\1%\(([^)]*)\)s', r'\1{\2}', tmpl).replace('%%','%')
|
|
||||||
filename = sanitize_path(string.Formatter().vformat(tmpl, None, template_dict))
|
|
||||||
# Temporary fix for #4787
|
# Temporary fix for #4787
|
||||||
# 'Treat' all problem characters by passing filename through preferredencoding
|
# 'Treat' all problem characters by passing filename through preferredencoding
|
||||||
# to workaround encoding issues with subprocess on python2 @ Windows
|
# to workaround encoding issues with subprocess on python2 @ Windows
|
||||||
|
Loading…
x
Reference in New Issue
Block a user