Added placeholder command runner for apprise

This commit is contained in:
Kieran Eglin 2024-04-05 10:12:02 -07:00
parent e9c14e1450
commit e5c1a41853
No known key found for this signature in database
GPG key ID: 193984967FCF432D
4 changed files with 19 additions and 6 deletions

View file

@ -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

View file

@ -7,9 +7,9 @@ defmodule Pinchflat.YtDlp.CommandRunner do
alias Pinchflat.Utils.StringUtils alias Pinchflat.Utils.StringUtils
alias Pinchflat.Filesystem.FilesystemHelpers, as: FSUtils alias Pinchflat.Filesystem.FilesystemHelpers, as: FSUtils
alias Pinchflat.YtDlp.BackendCommandRunner alias Pinchflat.YtDlp.YtDlpCommandRunner
@behaviour BackendCommandRunner @behaviour YtDlpCommandRunner
@doc """ @doc """
Runs a yt-dlp command and returns the string output. Saves the output to 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}. Returns {:ok, binary()} | {:error, output, status}.
""" """
@impl BackendCommandRunner @impl YtDlpCommandRunner
def run(url, command_opts, output_template, addl_opts \\ []) do def run(url, command_opts, output_template, addl_opts \\ []) do
# This approach lets us mock the command for testing # This approach lets us mock the command for testing
command = backend_executable() command = backend_executable()
@ -48,7 +48,7 @@ defmodule Pinchflat.YtDlp.CommandRunner do
end end
end end
@impl BackendCommandRunner @impl YtDlpCommandRunner
def version do def version do
command = backend_executable() command = backend_executable()

View file

@ -1,4 +1,4 @@
defmodule Pinchflat.YtDlp.BackendCommandRunner do defmodule Pinchflat.YtDlp.YtDlpCommandRunner do
@moduledoc """ @moduledoc """
A behaviour for running CLI commands against a downloader backend (yt-dlp). A behaviour for running CLI commands against a downloader backend (yt-dlp).

View file

@ -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) Application.put_env(:pinchflat, :yt_dlp_runner, YtDlpRunnerMock)
Mox.defmock(HTTPClientMock, for: Pinchflat.HTTP.HTTPBehaviour) Mox.defmock(HTTPClientMock, for: Pinchflat.HTTP.HTTPBehaviour)