Browse Source

[downloader/common] Limit displaying 2 digits after decimal point in sleep interval message

master
Pratyush Singh 8 years ago
committed by Sergey M․
parent
commit
d374d943f3
No known key found for this signature in database GPG Key ID: 2C393E0F18A9236D
1 changed files with 4 additions and 1 deletions
  1. 5
      youtube_dl/downloader/common.py

5
youtube_dl/downloader/common.py

@ -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)

Loading…
Cancel
Save