Added yt-dlp version to sidebar (#155)

This commit is contained in:
Kieran
2024-04-01 17:54:51 -07:00
committed by GitHub
parent 0eca0acbe8
commit c58e176619
6 changed files with 37 additions and 4 deletions
@@ -8,4 +8,5 @@ defmodule Pinchflat.YtDlp.BackendCommandRunner do
@callback run(binary(), keyword(), binary()) :: {:ok, binary()} | {:error, binary(), integer()}
@callback run(binary(), keyword(), binary(), keyword()) :: {:ok, binary()} | {:error, binary(), integer()}
@callback version() :: {:ok, binary()} | {:error, binary()}
end
+13
View File
@@ -48,6 +48,19 @@ defmodule Pinchflat.YtDlp.CommandRunner do
end
end
@impl BackendCommandRunner
def version do
command = backend_executable()
case System.cmd(command, ["--version"]) do
{output, 0} ->
{:ok, String.trim(output)}
{output, _} ->
{:error, output}
end
end
defp build_cookie_options do
base_dir = Application.get_env(:pinchflat, :extras_directory)
cookie_file = Path.join(base_dir, "cookies.txt")