mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-05 18:39:37 +02:00
added --autonumber-start NUMBER as a command line option to be able to offset the index at which autonumber formats filenames
This commit is contained in:
parent
4edeac5bfa
commit
acbb2374bc
@ -584,7 +584,7 @@ def prepare_filename(self, info_dict):
|
|||||||
if autonumber_size is None:
|
if autonumber_size is None:
|
||||||
autonumber_size = 5
|
autonumber_size = 5
|
||||||
autonumber_templ = '%0' + str(autonumber_size) + 'd'
|
autonumber_templ = '%0' + str(autonumber_size) + 'd'
|
||||||
template_dict['autonumber'] = autonumber_templ % self._num_downloads
|
template_dict['autonumber'] = autonumber_templ % (self.params.get('autonumber_start', 1) - 1 + 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:
|
||||||
|
@ -321,6 +321,7 @@ def parse_retries(retries):
|
|||||||
'listformats': opts.listformats,
|
'listformats': opts.listformats,
|
||||||
'outtmpl': outtmpl,
|
'outtmpl': outtmpl,
|
||||||
'autonumber_size': opts.autonumber_size,
|
'autonumber_size': opts.autonumber_size,
|
||||||
|
'autonumber_start': opts.autonumber_start,
|
||||||
'restrictfilenames': opts.restrictfilenames,
|
'restrictfilenames': opts.restrictfilenames,
|
||||||
'ignoreerrors': opts.ignoreerrors,
|
'ignoreerrors': opts.ignoreerrors,
|
||||||
'force_generic_extractor': opts.force_generic_extractor,
|
'force_generic_extractor': opts.force_generic_extractor,
|
||||||
|
@ -663,6 +663,10 @@ def _scrub_eq(o):
|
|||||||
'--autonumber-size',
|
'--autonumber-size',
|
||||||
dest='autonumber_size', metavar='NUMBER',
|
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')
|
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', type="int", default=1,
|
||||||
|
help='Specify the start value for the %(autonumber)s counter. Defaults to 1.')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'--restrict-filenames',
|
'--restrict-filenames',
|
||||||
action='store_true', dest='restrictfilenames', default=False,
|
action='store_true', dest='restrictfilenames', default=False,
|
||||||
|
Loading…
Reference in New Issue
Block a user