From 31108ce946eccbe765b12f0b8a9a47622af68c27 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 1 Nov 2020 03:36:16 +0100 Subject: [PATCH] [core] sleep-subtitles fix --- youtube_dlc/downloader/common.py | 11 ++++++----- youtube_dlc/options.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/youtube_dlc/downloader/common.py b/youtube_dlc/downloader/common.py index 460364a0b..c65500d61 100644 --- a/youtube_dlc/downloader/common.py +++ b/youtube_dlc/downloader/common.py @@ -364,11 +364,12 @@ class FileDownloader(object): else '%.2f' % sleep_interval)) time.sleep(sleep_interval) else: - sleep_interval_sub = self.params.get('sleep_interval_subtitles') - self.to_screen( - '[download] Sleeping %s seconds...' % ( - int(sleep_interval_sub))) - time.sleep(sleep_interval_sub) + if self.params.get('sleep_interval_subtitles') > 0: + sleep_interval_sub = self.params.get('sleep_interval_subtitles') + 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): diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py index 66b45220c..3c8a1305e 100644 --- a/youtube_dlc/options.py +++ b/youtube_dlc/options.py @@ -582,7 +582,7 @@ def parseOpts(overrideArguments=None): 'along with --min-sleep-interval.')) workarounds.add_option( '--sleep-subtitles', - dest='sleep_interval_subtitles', action='store_true', default=0, + dest='sleep_interval_subtitles', default=0, type=int, help='Enforce sleep interval on subtitles as well') verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')