mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 23:02:34 +00:00
[cleanup] Revert unnecessary changes in 51d9739f80
This commit is contained in:
parent
51d9739f80
commit
8a77e5e6bc
1 changed files with 2 additions and 3 deletions
|
@ -14,7 +14,6 @@ from ..utils import (
|
||||||
format_bytes,
|
format_bytes,
|
||||||
shell_quote,
|
shell_quote,
|
||||||
timeconvert,
|
timeconvert,
|
||||||
ThrottledDownload,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +171,7 @@ class FileDownloader(object):
|
||||||
def slow_down(self, start_time, now, byte_counter):
|
def slow_down(self, start_time, now, byte_counter):
|
||||||
"""Sleep if the download speed is over the rate limit."""
|
"""Sleep if the download speed is over the rate limit."""
|
||||||
rate_limit = self.params.get('ratelimit')
|
rate_limit = self.params.get('ratelimit')
|
||||||
if byte_counter == 0:
|
if rate_limit is None or byte_counter == 0:
|
||||||
return
|
return
|
||||||
if now is None:
|
if now is None:
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
@ -180,7 +179,7 @@ class FileDownloader(object):
|
||||||
if elapsed <= 0.0:
|
if elapsed <= 0.0:
|
||||||
return
|
return
|
||||||
speed = float(byte_counter) / elapsed
|
speed = float(byte_counter) / elapsed
|
||||||
if rate_limit is not None and speed > rate_limit:
|
if speed > rate_limit:
|
||||||
sleep_time = float(byte_counter) / rate_limit - elapsed
|
sleep_time = float(byte_counter) / rate_limit - elapsed
|
||||||
if sleep_time > 0:
|
if sleep_time > 0:
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
|
|
Loading…
Reference in a new issue