mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
[Enhancement] Add download rate limiting to app settings (#646)
* Added rate limit column to settings * Added limit_rate option to command runner * Added rate limit to settings form
This commit is contained in:
parent
0fbf810cb6
commit
4554648ba7
6 changed files with 47 additions and 4 deletions
|
|
@ -96,7 +96,7 @@ defmodule Pinchflat.YtDlp.CommandRunnerTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "run/4 when testing sleep interval options" do
|
||||
describe "run/4 when testing rate limit options" do
|
||||
test "includes sleep interval options by default" do
|
||||
Settings.set(extractor_sleep_interval_seconds: 5)
|
||||
|
||||
|
|
@ -124,6 +124,22 @@ defmodule Pinchflat.YtDlp.CommandRunnerTest do
|
|||
refute String.contains?(output, "--sleep-requests")
|
||||
refute String.contains?(output, "--sleep-subtitles")
|
||||
end
|
||||
|
||||
test "includes limit_rate option when specified" do
|
||||
Settings.set(download_throughput_limit: "100K")
|
||||
|
||||
assert {:ok, output} = Runner.run(@media_url, :foo, [], "")
|
||||
|
||||
assert String.contains?(output, "--limit-rate 100K")
|
||||
end
|
||||
|
||||
test "doesn't include limit_rate option when download_throughput_limit is nil" do
|
||||
Settings.set(download_throughput_limit: nil)
|
||||
|
||||
assert {:ok, output} = Runner.run(@media_url, :foo, [], "")
|
||||
|
||||
refute String.contains?(output, "--limit-rate")
|
||||
end
|
||||
end
|
||||
|
||||
describe "run/4 when testing global options" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue