From e5c1a41853d9db5cebae726198d6365ab5e8b331 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Fri, 5 Apr 2024 10:12:02 -0700 Subject: [PATCH] Added placeholder command runner for apprise --- lib/pinchflat/notifications/command_runner.ex | 13 +++++++++++++ lib/pinchflat/yt_dlp/command_runner.ex | 8 ++++---- ...d_command_runner.ex => yt_dlp_command_runner.ex} | 2 +- test/test_helper.exs | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 lib/pinchflat/notifications/command_runner.ex rename lib/pinchflat/yt_dlp/{backend_command_runner.ex => yt_dlp_command_runner.ex} (90%) diff --git a/lib/pinchflat/notifications/command_runner.ex b/lib/pinchflat/notifications/command_runner.ex new file mode 100644 index 0000000..5481c9d --- /dev/null +++ b/lib/pinchflat/notifications/command_runner.ex @@ -0,0 +1,13 @@ +defmodule Pinchflat.Notifications.CommandRunner do + @moduledoc """ + Runs apprise commands using the `System.cmd/3` function + """ + + require Logger + + @doc """ + # TODO + """ + def run do + end +end diff --git a/lib/pinchflat/yt_dlp/command_runner.ex b/lib/pinchflat/yt_dlp/command_runner.ex index 7512768..f0fcd37 100644 --- a/lib/pinchflat/yt_dlp/command_runner.ex +++ b/lib/pinchflat/yt_dlp/command_runner.ex @@ -7,9 +7,9 @@ defmodule Pinchflat.YtDlp.CommandRunner do alias Pinchflat.Utils.StringUtils alias Pinchflat.Filesystem.FilesystemHelpers, as: FSUtils - alias Pinchflat.YtDlp.BackendCommandRunner + alias Pinchflat.YtDlp.YtDlpCommandRunner - @behaviour BackendCommandRunner + @behaviour YtDlpCommandRunner @doc """ Runs a yt-dlp command and returns the string output. Saves the output to @@ -23,7 +23,7 @@ defmodule Pinchflat.YtDlp.CommandRunner do Returns {:ok, binary()} | {:error, output, status}. """ - @impl BackendCommandRunner + @impl YtDlpCommandRunner def run(url, command_opts, output_template, addl_opts \\ []) do # This approach lets us mock the command for testing command = backend_executable() @@ -48,7 +48,7 @@ defmodule Pinchflat.YtDlp.CommandRunner do end end - @impl BackendCommandRunner + @impl YtDlpCommandRunner def version do command = backend_executable() diff --git a/lib/pinchflat/yt_dlp/backend_command_runner.ex b/lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex similarity index 90% rename from lib/pinchflat/yt_dlp/backend_command_runner.ex rename to lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex index e09eaeb..9b46a32 100644 --- a/lib/pinchflat/yt_dlp/backend_command_runner.ex +++ b/lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex @@ -1,4 +1,4 @@ -defmodule Pinchflat.YtDlp.BackendCommandRunner do +defmodule Pinchflat.YtDlp.YtDlpCommandRunner do @moduledoc """ A behaviour for running CLI commands against a downloader backend (yt-dlp). diff --git a/test/test_helper.exs b/test/test_helper.exs index bea0589..e5f74bb 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,4 +1,4 @@ -Mox.defmock(YtDlpRunnerMock, for: Pinchflat.YtDlp.BackendCommandRunner) +Mox.defmock(YtDlpRunnerMock, for: Pinchflat.YtDlp.YtDlpCommandRunner) Application.put_env(:pinchflat, :yt_dlp_runner, YtDlpRunnerMock) Mox.defmock(HTTPClientMock, for: Pinchflat.HTTP.HTTPBehaviour)