aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/downloader/common.py
diff options
context:
space:
mode:
authorTom-Oliver Heidel <github@tom-oliver.eu>2020-11-30 02:51:41 +0100
committerGitHub <noreply@github.com>2020-11-30 02:51:41 +0100
commitb662fc8d2033c615ffbdd3b51123b446c03255e8 (patch)
tree3d32dc25a663f4e61fc28860acda67c7a425cb7a /youtube_dlc/downloader/common.py
parent8924ddc3eec4c03c6776673d0d5e823dc5445549 (diff)
parent929576bb9e4aa31f0516f1437d2ae762afdd9f2c (diff)
downloadhypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.tar.lz
hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.tar.xz
hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.zip
Merge branch 'master' into gedi
Diffstat (limited to 'youtube_dlc/downloader/common.py')
-rw-r--r--youtube_dlc/downloader/common.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/youtube_dlc/downloader/common.py b/youtube_dlc/downloader/common.py
index 31c286458..7d303be1c 100644
--- a/youtube_dlc/downloader/common.py
+++ b/youtube_dlc/downloader/common.py
@@ -326,7 +326,7 @@ class FileDownloader(object):
"""Report it was impossible to resume download."""
self.to_screen('[download] Unable to resume')
- def download(self, filename, info_dict):
+ def download(self, filename, info_dict, subtitle=False):
"""Download to a filename using the info from info_dict
Return True on success and False otherwise
"""
@@ -353,16 +353,25 @@ class FileDownloader(object):
})
return True
- min_sleep_interval = self.params.get('sleep_interval')
- 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...' % (
- int(sleep_interval) if sleep_interval.is_integer()
- else '%.2f' % sleep_interval))
- time.sleep(sleep_interval)
-
+ if subtitle is False:
+ min_sleep_interval = self.params.get('sleep_interval')
+ 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...' % (
+ int(sleep_interval) if sleep_interval.is_integer()
+ else '%.2f' % sleep_interval))
+ time.sleep(sleep_interval)
+ else:
+ sleep_interval_sub = 0
+ if type(self.params.get('sleep_interval_subtitles')) is int:
+ sleep_interval_sub = self.params.get('sleep_interval_subtitles')
+ if sleep_interval_sub > 0:
+ self.to_screen(
+ '[download] Sleeping %s seconds...' % (
+ sleep_interval_sub))
+ time.sleep(sleep_interval_sub)
return self.real_download(filename, info_dict)
def real_download(self, filename, info_dict):