Restructured files; Added parser placeholder
This commit is contained in:
parent
bad3e10fea
commit
28de959201
8 changed files with 17 additions and 10 deletions
|
|
@ -12,7 +12,7 @@ config :pinchflat,
|
|||
generators: [timestamp_type: :utc_datetime],
|
||||
# Specifying backend data here makes mocking and local testing SUPER easy
|
||||
yt_dlp_executable: System.find_executable("yt-dlp"),
|
||||
yt_dlp_runner: Pinchflat.DownloaderBackends.YtDlp.CommandRunner
|
||||
yt_dlp_runner: Pinchflat.Downloader.Backends.YtDlp.CommandRunner
|
||||
|
||||
# Configures the endpoint
|
||||
config :pinchflat, PinchflatWeb.Endpoint,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
defmodule Pinchflat.Downloader.Backends.BackendCommandRunner do
|
||||
@moduledoc """
|
||||
A behaviour for running CLI commands against a downloader backend
|
||||
"""
|
||||
|
||||
@callback run(binary(), keyword()) :: {:ok, binary()} | {:error, binary(), integer()}
|
||||
end
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
defmodule Pinchflat.DownloaderBackends.YtDlp.CommandRunner do
|
||||
defmodule Pinchflat.Downloader.Backends.YtDlp.CommandRunner do
|
||||
@moduledoc """
|
||||
Runs yt-dlp commands using the `System.cmd/3` function
|
||||
"""
|
||||
|
||||
alias Pinchflat.Utils.StringUtils
|
||||
alias Pinchflat.DownloaderBackends.BackendCommandRunner
|
||||
alias Pinchflat.Downloader.Backends.BackendCommandRunner
|
||||
|
||||
@behaviour BackendCommandRunner
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Pinchflat.DownloaderBackends.YtDlp.VideoCollection do
|
||||
defmodule Pinchflat.Downloader.Backends.YtDlp.VideoCollection do
|
||||
@moduledoc """
|
||||
Contains utilities for working with collections of videos (ie: channels, playlists)
|
||||
"""
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
defmodule Pinchflat.DownloaderBackends.BackendCommandRunner do
|
||||
defmodule Pinchflat.Downloader.Filepath.Parser do
|
||||
@moduledoc """
|
||||
A behaviour for running CLI commands against a downloader backend
|
||||
"""
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
defmodule Pinchflat.DownloaderBackends.YtDlp.CommandRunnerTest do
|
||||
defmodule Pinchflat.Downloader.Backends.YtDlp.CommandRunnerTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
alias Pinchflat.DownloaderBackends.YtDlp.CommandRunner, as: Runner
|
||||
alias Pinchflat.Downloader.Backends.YtDlp.CommandRunner, as: Runner
|
||||
|
||||
@original_executable Application.compile_env(:pinchflat, :yt_dlp_executable)
|
||||
@video_url "https://www.youtube.com/watch?v=9bZkp7q19f0"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
defmodule Pinchflat.DownloaderBackends.YtDlp.VideoCollectionTest do
|
||||
defmodule Pinchflat.Downloader.Backends.YtDlp.VideoCollectionTest do
|
||||
use ExUnit.Case, async: true
|
||||
import Mox
|
||||
|
||||
alias Pinchflat.DownloaderBackends.YtDlp.VideoCollection, as: VideoCollection
|
||||
alias Pinchflat.Downloader.Backends.YtDlp.VideoCollection, as: VideoCollection
|
||||
|
||||
@channel_url "https://www.youtube.com/@TheUselessTrials"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Mox.defmock(CommandRunnerMock, for: Pinchflat.DownloaderBackends.BackendCommandRunner)
|
||||
Mox.defmock(CommandRunnerMock, for: Pinchflat.Downloader.Backends.BackendCommandRunner)
|
||||
Application.put_env(:pinchflat, :yt_dlp_runner, CommandRunnerMock)
|
||||
|
||||
ExUnit.start()
|
||||
|
|
|
|||
Loading…
Reference in a new issue