mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-25 07:45:38 +08:00
Added --autonumber-start [number] option
This commit is contained in:
parent
1198fe14a1
commit
13299df976
@ -578,10 +578,13 @@ class YoutubeDL(object):
|
||||
|
||||
template_dict['epoch'] = int(time.time())
|
||||
autonumber_size = self.params.get('autonumber_size')
|
||||
autonumber_start = self.params.get('autonumber_start')
|
||||
if autonumber_size is None:
|
||||
autonumber_size = 5
|
||||
if autonumber_start is None or autonumber_start < 1:
|
||||
autonumber_start = 1
|
||||
autonumber_templ = '%0' + str(autonumber_size) + 'd'
|
||||
template_dict['autonumber'] = autonumber_templ % self._num_downloads
|
||||
template_dict['autonumber'] = autonumber_templ % (self._num_downloads + int(autonumber_start)-1)
|
||||
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'])
|
||||
if template_dict.get('resolution') is None:
|
||||
|
@ -311,6 +311,7 @@ def _real_main(argv=None):
|
||||
'listformats': opts.listformats,
|
||||
'outtmpl': outtmpl,
|
||||
'autonumber_size': opts.autonumber_size,
|
||||
'autonumber_start': opts.autonumber_start,
|
||||
'restrictfilenames': opts.restrictfilenames,
|
||||
'ignoreerrors': opts.ignoreerrors,
|
||||
'force_generic_extractor': opts.force_generic_extractor,
|
||||
|
@ -633,6 +633,10 @@ def parseOpts(overrideArguments=None):
|
||||
'--autonumber-size',
|
||||
dest='autonumber_size', metavar='NUMBER',
|
||||
help='Specify the number of digits in %(autonumber)s when it is present in output filename template or --auto-number option is given')
|
||||
filesystem.add_option(
|
||||
'--autonumber-start',
|
||||
dest='autonumber_start', metavar='NUMBER', default=0,
|
||||
help='Starts %(autonumber)s at the passed number (positive numbers only).')
|
||||
filesystem.add_option(
|
||||
'--restrict-filenames',
|
||||
action='store_true', dest='restrictfilenames', default=False,
|
||||
@ -700,6 +704,7 @@ def parseOpts(overrideArguments=None):
|
||||
action='store_true', dest='rm_cachedir',
|
||||
help='Delete all filesystem cache files')
|
||||
|
||||
|
||||
thumbnail = optparse.OptionGroup(parser, 'Thumbnail images')
|
||||
thumbnail.add_option(
|
||||
'--write-thumbnail',
|
||||
|
Loading…
Reference in New Issue
Block a user