aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xyoutube_dl/YoutubeDL.py2
-rw-r--r--youtube_dl/__init__.py1
-rw-r--r--youtube_dl/options.py4
3 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 41d9a63ee..c71e94518 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -584,7 +584,7 @@ class YoutubeDL(object):
if autonumber_size is None:
autonumber_size = 5
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:
template_dict['playlist_index'] = '%0*d' % (len(str(template_dict['n_entries'])), template_dict['playlist_index'])
if template_dict.get('resolution') is None:
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index dfa4ae839..577bc880f 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -321,6 +321,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,
diff --git a/youtube_dl/options.py b/youtube_dl/options.py
index 09c9387ca..571525434 100644
--- a/youtube_dl/options.py
+++ b/youtube_dl/options.py
@@ -664,6 +664,10 @@ def parseOpts(overrideArguments=None):
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', type="int", default=1,
+ help='Specify the start value for the %(autonumber)s counter. Defaults to 1.')
+ filesystem.add_option(
'--restrict-filenames',
action='store_true', dest='restrictfilenames', default=False,
help='Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames')