From 493d36a8adf9477e8b59ff3f54956e77f78474c7 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Fri, 13 Dec 2024 10:00:35 -0800 Subject: [PATCH] Updated yt-dlp runner to take an action type --- lib/pinchflat/yt_dlp/command_runner.ex | 5 ++++- lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pinchflat/yt_dlp/command_runner.ex b/lib/pinchflat/yt_dlp/command_runner.ex index 7cd21dd..5d71661 100644 --- a/lib/pinchflat/yt_dlp/command_runner.ex +++ b/lib/pinchflat/yt_dlp/command_runner.ex @@ -3,6 +3,8 @@ defmodule Pinchflat.YtDlp.CommandRunner do Runs yt-dlp commands using the `System.cmd/3` function """ + require Logger + alias Pinchflat.Utils.CliUtils alias Pinchflat.YtDlp.YtDlpCommandRunner alias Pinchflat.Utils.FilesystemUtils, as: FSUtils @@ -24,7 +26,8 @@ defmodule Pinchflat.YtDlp.CommandRunner do Returns {:ok, binary()} | {:error, output, status}. """ @impl YtDlpCommandRunner - def run(url, command_opts, output_template, addl_opts \\ []) do + def run(url, action_name, command_opts, output_template, addl_opts \\ []) do + Logger.debug("Running yt-dlp command for action: #{action_name}") # This approach lets us mock the command for testing command = backend_executable() diff --git a/lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex b/lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex index 9b46a32..ff1cbcf 100644 --- a/lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex +++ b/lib/pinchflat/yt_dlp/yt_dlp_command_runner.ex @@ -6,7 +6,7 @@ defmodule Pinchflat.YtDlp.YtDlpCommandRunner do yt-dlp command. """ - @callback run(binary(), keyword(), binary()) :: {:ok, binary()} | {:error, binary(), integer()} - @callback run(binary(), keyword(), binary(), keyword()) :: {:ok, binary()} | {:error, binary(), integer()} + @callback run(binary(), atom(), keyword(), binary()) :: {:ok, binary()} | {:error, binary(), integer()} + @callback run(binary(), atom(), keyword(), binary(), keyword()) :: {:ok, binary()} | {:error, binary(), integer()} @callback version() :: {:ok, binary()} | {:error, binary()} end