Added --playlist-index-offset parameter

This commit is contained in:
JewsOfHazard 2016-08-28 02:02:16 -07:00
parent 1198fe14a1
commit c810f20e96
3 changed files with 6 additions and 1 deletions

View File

@ -583,7 +583,7 @@ class YoutubeDL(object):
autonumber_templ = '%0' + str(autonumber_size) + 'd'
template_dict['autonumber'] = autonumber_templ % 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'])
template_dict['playlist_index'] = '%0*d' % (len(str(template_dict['n_entries'])), (int(template_dict['playlist_index']) + int(self.params.get('playlist_index_offset'))))
if template_dict.get('resolution') is None:
if template_dict.get('width') and template_dict.get('height'):
template_dict['resolution'] = '%dx%d' % (template_dict['width'], template_dict['height'])

View File

@ -326,6 +326,7 @@ def _real_main(argv=None):
'playliststart': opts.playliststart,
'playlistend': opts.playlistend,
'playlistreverse': opts.playlist_reverse,
'playlist_index_offset': opts.playlist_index_offset,
'noplaylist': opts.noplaylist,
'logtostderr': opts.outtmpl == '-',
'consoletitle': opts.consoletitle,

View File

@ -699,6 +699,10 @@ def parseOpts(overrideArguments=None):
'--rm-cache-dir',
action='store_true', dest='rm_cachedir',
help='Delete all filesystem cache files')
filesystem.add_option(
'--playlist-index-offset',
dest="playlist_index_offset", metavar='NUMBER', type=int, default=0,
help='Offsets %(playlist_index)s by the specified value.')
thumbnail = optparse.OptionGroup(parser, 'Thumbnail images')
thumbnail.add_option(