Merge remote-tracking branch 'JGjorgji/fix-leading-zeroes'
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 25 Aug 2014 11:59:19 +0000 (13:59 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 25 Aug 2014 11:59:19 +0000 (13:59 +0200)
1  2 
youtube_dl/YoutubeDL.py

diff --combined youtube_dl/YoutubeDL.py
index e0cb1ef75fd5b4fb86638f3f6a872d1e1625b1f0,5776423775392a09dc6376b48dca1ab04a5f5ceb..98639e004c4502bef367eb23b6180269f29e54f7
@@@ -172,7 -172,6 +172,7 @@@ class YoutubeDL(object)
      The following options are used by the post processors:
      prefer_ffmpeg:     If True, use ffmpeg instead of avconv if both are available,
                         otherwise prefer avconv.
 +    exec_cmd:          Arbitrary command to run after downloading
      """
  
      params = None
              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'])
              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'],