]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[downloader/common] Limit displaying 2 digits after decimal point in sleep interval...
authorPratyush Singh <singh.pratyush96@gmail.com>
Sat, 24 Dec 2016 15:35:41 +0000 (21:05 +0530)
committerSergey M․ <dstftw@gmail.com>
Sat, 25 Feb 2017 13:59:04 +0000 (20:59 +0700)
youtube_dl/downloader/common.py

index 3dc144b4e19f208d4075d6423ce3278b3a614330..2c4470a9549ac0eef1eff8cb413d1e522876e677 100644 (file)
@@ -347,7 +347,10 @@ class FileDownloader(object):
         if min_sleep_interval:
             max_sleep_interval = self.params.get('max_sleep_interval', min_sleep_interval)
             sleep_interval = random.uniform(min_sleep_interval, max_sleep_interval)
-            self.to_screen('[download] Sleeping %s seconds...' % sleep_interval)
+            self.to_screen(
+                '[download] Sleeping %s seconds...' % (
+                    int(sleep_interval) if sleep_interval.is_integer()
+                    else '%.2f' % sleep_interval))
             time.sleep(sleep_interval)
 
         return self.real_download(filename, info_dict)