Skip to content

Commit

Permalink
Added support for ytdlp cache (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
kieraneglin authored May 15, 2024
1 parent 8d9bd11 commit dcf033f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pinchflat/yt_dlp/command_runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ defmodule Pinchflat.YtDlp.CommandRunner do
end

defp global_options do
[:windows_filenames, :quiet]
[
:windows_filenames,
:quiet,
cache_dir: Path.join(Application.get_env(:pinchflat, :tmpfile_directory), "yt-dlp-cache")
]
end

defp cookie_file_options do
Expand Down
6 changes: 6 additions & 0 deletions test/pinchflat/yt_dlp/command_runner_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ defmodule Pinchflat.YtDlp.CommandRunnerTest do

assert String.contains?(output, "--quiet")
end

test "sets the cache directory" do
assert {:ok, output} = Runner.run(@media_url, [], "")

assert String.contains?(output, "--cache-dir /tmp/test/tmpfiles/yt-dlp-cache")
end
end

describe "version/0" do
Expand Down

0 comments on commit dcf033f

Please sign in to comment.