From 666c36d58dfacc8998952569cc2d9c414957c53d Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 20 May 2022 20:49:30 +0530 Subject: [PATCH] Bugfix for 23326151c45b632c3d5948bd018e80abb370e676 --- yt_dlp/downloader/common.py | 6 +++--- yt_dlp/downloader/fragment.py | 17 +++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/yt_dlp/downloader/common.py b/yt_dlp/downloader/common.py index 0b3383071..276675532 100644 --- a/yt_dlp/downloader/common.py +++ b/yt_dlp/downloader/common.py @@ -18,8 +18,8 @@ decodeArgument, encodeFilename, error_to_compat_str, + float_or_none, format_bytes, - int_or_none, sanitize_open, shell_quote, timeconvert, @@ -406,9 +406,9 @@ def report_unable_to_resume(self): def sleep_retry(self, retry_type, count): sleep_func = self.params.get('retry_sleep_functions', {}).get(retry_type) - delay = int_or_none(sleep_func(n=count - 1)) if sleep_func else None + delay = float_or_none(sleep_func(n=count - 1)) if sleep_func else None if delay: - self.__to_screen(f'Sleeping {delay} seconds ...') + self.__to_screen(f'Sleeping {delay:.2f} seconds ...') time.sleep(delay) return sleep_func is not None diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py index 410c8c1a4..493849001 100644 --- a/yt_dlp/downloader/fragment.py +++ b/yt_dlp/downloader/fragment.py @@ -165,18 +165,11 @@ def _prepare_frag_download(self, ctx): total_frags_str = 'unknown (live)' self.to_screen(f'[{self.FD_NAME}] Total fragments: {total_frags_str}') self.report_destination(ctx['filename']) - dl = HttpQuietDownloader( - self.ydl, - { - 'continuedl': self.params.get('continuedl', True), - 'quiet': self.params.get('quiet'), - 'noprogress': True, - 'ratelimit': self.params.get('ratelimit'), - 'retries': self.params.get('retries', 0), - 'nopart': self.params.get('nopart', False), - 'test': False, - } - ) + dl = HttpQuietDownloader(self.ydl, { + **self.params, + 'noprogress': True, + 'test': False, + }) tmpfilename = self.temp_name(ctx['filename']) open_mode = 'wb' resume_len = 0