]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorrupertbaxter2 <rupertbaxter2@yahoo.com>
Wed, 13 Aug 2014 11:22:45 +0000 (04:22 -0700)
committerrupertbaxter2 <rupertbaxter2@yahoo.com>
Wed, 13 Aug 2014 11:22:45 +0000 (04:22 -0700)
1  2 
youtube_dl/__init__.py
youtube_dl/downloader/common.py

diff --combined youtube_dl/__init__.py
index b4194494fc86292afb17ed7beb3b7a5cc014a652,962aedbff7d47c8d51511a6a1c76d5db65b4e9da..6daed53655b12b6476773a9be02abb901cb1f359
@@@ -68,6 -68,7 +68,7 @@@ __authors__  = 
      'Hassaan Ali',
      'Dobrosław Żybort',
      'David Fabijan',
+     'Sebastian Haas',
  )
  
  __license__ = 'Public Domain'
@@@ -353,8 -354,6 +354,8 @@@ def parseOpts(overrideArguments=None)
  
      downloader.add_option('-r', '--rate-limit',
              dest='ratelimit', metavar='LIMIT', help='maximum download rate in bytes per second (e.g. 50K or 4.2M)')
 +    downloader.add_option('--sleep-interval',
 +            dest='sleepinterval', metavar='SLEEPINTERVAL', help='number of seconds to sleep between downloads (default is %default)', default="0")
      downloader.add_option('-R', '--retries',
              dest='retries', metavar='RETRIES', help='number of retries (default is %default)', default=10)
      downloader.add_option('--buffer-size',
@@@ -675,11 -674,6 +676,11 @@@ def _real_main(argv=None)
          if numeric_limit is None:
              parser.error(u'invalid rate limit specified')
          opts.ratelimit = numeric_limit
 +    if opts.sleepinterval is not None:
 +        try:
 +            opts.sleepinterval = abs(int(opts.sleepinterval))
 +        except ValueError:
 +            parser.error(u'invalid sleep interval specified')
      if opts.min_filesize is not None:
          numeric_limit = FileDownloader.parse_bytes(opts.min_filesize)
          if numeric_limit is None:
          'restrictfilenames': opts.restrictfilenames,
          'ignoreerrors': opts.ignoreerrors,
          'ratelimit': opts.ratelimit,
 +        'sleepinterval': opts.sleepinterval,
          'nooverwrites': opts.nooverwrites,
          'retries': opts.retries,
          'buffersize': opts.buffersize,
index 8e0e386bf185803e07b89bea3ee46c5ffb62e527,9ce97f5fe6c4517ec8b6d681e924bcd387a185cf..48e829debe65388dc17a8f4a9642057fecbc14b9
@@@ -278,9 -278,6 +278,9 @@@ class FileDownloader(object)
          """Download to a filename using the info from info_dict
          Return True on success and False otherwise
          """
 +        sleep_interval = self.params.get('sleepinterval', 0)
 +        self.to_screen(u'[download] Sleeping %d seconds...' %sleep_interval)
 +        time.sleep(sleep_interval)
          # Check file already present
          if self.params.get('continuedl', False) and os.path.isfile(encodeFilename(filename)) and not self.params.get('nopart', False):
              self.report_file_already_downloaded(filename)
  
      def real_download(self, filename, info_dict):
          """Real download process. Redefine in subclasses."""
-         raise NotImplementedError(u'This method must be implemented by sublcasses')
+         raise NotImplementedError(u'This method must be implemented by subclasses')
  
      def _hook_progress(self, status):
          for ph in self._progress_hooks: