Added placeholder command runner for apprise
This commit is contained in:
parent
e9c14e1450
commit
e5c1a41853
4 changed files with 19 additions and 6 deletions
13
lib/pinchflat/notifications/command_runner.ex
Normal file
13
lib/pinchflat/notifications/command_runner.ex
Normal 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
|
||||||
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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).
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue