about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-08-25 13:59:19 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-08-25 13:59:19 +0200
commit241f7a8adeab76a5cbc9e5a82649b0638a61a328 (patch)
tree53db52b4a2cf10df1b4904da6e38e20349067fdd
parentb252735910a20ccbcf327a778ac014d674a44428 (diff)
parentc6b4132a0ad568b8383dfb64689b7d45182f275a (diff)
downloadyoutube-dl-241f7a8adeab76a5cbc9e5a82649b0638a61a328.tar.gz
youtube-dl-241f7a8adeab76a5cbc9e5a82649b0638a61a328.tar.xz
youtube-dl-241f7a8adeab76a5cbc9e5a82649b0638a61a328.zip
Merge remote-tracking branch 'JGjorgji/fix-leading-zeroes'
-rwxr-xr-xyoutube_dl/YoutubeDL.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index e0cb1ef75..98639e004 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -425,7 +425,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'] = '%05d' % 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('width') and template_dict.get('height'):
                     template_dict['resolution'] = '%dx%d' % (template_dict['width'], template_dict['height'])
@@ -637,6 +637,7 @@ class YoutubeDL(object):
             for i, entry in enumerate(entries, 1):
                 self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
                 extra = {
+                    'n_entries': n_entries,
                     'playlist': playlist,
                     'playlist_index': i + playliststart,
                     'extractor': ie_result['extractor'],