From 5f3fc460c14b88c31f2475de9a85ada834c1415c Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 26 Oct 2021 17:14:26 +0700 Subject: [PATCH] implementing throttled-rate option --- tubearchivist/home/config.json | 3 ++- tubearchivist/home/src/download.py | 5 +++++ tubearchivist/home/templates/home/settings.html | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/config.json b/tubearchivist/home/config.json index 502ceda4..50e69d91 100644 --- a/tubearchivist/home/config.json +++ b/tubearchivist/home/config.json @@ -19,7 +19,8 @@ "sleep_interval": 3, "format": false, "add_metadata": false, - "add_thumbnail": false + "add_thumbnail": false, + "throttledratelimit": false }, "application": { "app_root": "/app", diff --git a/tubearchivist/home/src/download.py b/tubearchivist/home/src/download.py index e8d96e58..3f03a85e 100644 --- a/tubearchivist/home/src/download.py +++ b/tubearchivist/home/src/download.py @@ -515,6 +515,11 @@ class VideoDownloader: obs["format"] = self.config["downloads"]["format"] if self.config["downloads"]["limit_speed"]: obs["ratelimit"] = self.config["downloads"]["limit_speed"] * 1024 + + throttle = self.config["downloads"]["throttledratelimit"] + if throttle: + obs["throttledratelimit"] = throttle * 1024 + external = False if external: obs["external_downloader"] = "aria2c" diff --git a/tubearchivist/home/templates/home/settings.html b/tubearchivist/home/templates/home/settings.html index eea5fdb6..9dab5099 100644 --- a/tubearchivist/home/templates/home/settings.html +++ b/tubearchivist/home/templates/home/settings.html @@ -53,6 +53,11 @@ Limit download speed. 0 (zero) to deactivate.
KB/sec +
+

Current throttled rate limit: {{ config.downloads.throttledratelimit }}

+ Assume the download is being throttled below this speed and restart. 0 (zero) to deactivate, e.g. 100KB/sec
+ KB/sec +

Current scraping sleep interval: {{ config.downloads.sleep_interval }}

Seconds to sleep between calls to YouTube. Might be necessary to avoid throttling. Recommended 3.