added --autonumber-start NUMBER as a command line option to be able to offset the...
authorCosty Petrisor <costy.petrisor@gmail.com>
Sun, 1 May 2016 12:34:11 +0000 (12:34 +0000)
committerSergey M․ <dstftw@gmail.com>
Sat, 28 Jan 2017 17:00:45 +0000 (00:00 +0700)
youtube_dl/YoutubeDL.py
youtube_dl/__init__.py
youtube_dl/options.py

index 41d9a63eece80eb40cf068d1be74608daab5097d..c71e94518bd981edf682483c85aa059730368b40 100755 (executable)
@@ -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:
index dfa4ae839055621ab48b89527dbd50eb0c61c06f..577bc880fca4b0548cde69697c65064fe11326b7 100644 (file)
@@ -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,
index 09c9387caab2e1ef01f3e1862e34e21f9e8b49be..571525434e7e1f27a4a6b64318129940b2f51ba1 100644 (file)
@@ -663,6 +663,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', 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,