mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
[Enhancement] Add support for yt-dlp plugins + add lifecycle script event for app boot (#465)
* Added new script type to pre-job startup tasks * Updated Dockerfile to create the needful directories * added tests
This commit is contained in:
parent
83c10b2b00
commit
a02f71f304
5 changed files with 28 additions and 1 deletions
|
|
@ -16,6 +16,8 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
|||
alias Pinchflat.Settings
|
||||
alias Pinchflat.Utils.FilesystemUtils
|
||||
|
||||
alias Pinchflat.Lifecycle.UserScripts.CommandRunner, as: UserScriptRunner
|
||||
|
||||
def start_link(opts \\ []) do
|
||||
GenServer.start_link(__MODULE__, %{}, opts)
|
||||
end
|
||||
|
|
@ -36,6 +38,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
|||
create_blank_yt_dlp_files()
|
||||
create_blank_user_script_file()
|
||||
apply_default_settings()
|
||||
run_app_init_script()
|
||||
|
||||
{:ok, state}
|
||||
end
|
||||
|
|
@ -95,6 +98,12 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
|||
Settings.set(apprise_version: apprise_version)
|
||||
end
|
||||
|
||||
defp run_app_init_script do
|
||||
runner = Application.get_env(:pinchflat, :user_script_runner, UserScriptRunner)
|
||||
|
||||
runner.run(:app_init, %{})
|
||||
end
|
||||
|
||||
defp yt_dlp_runner do
|
||||
Application.get_env(:pinchflat, :yt_dlp_runner)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ defmodule Pinchflat.Lifecycle.UserScripts.CommandRunner do
|
|||
@behaviour UserScriptCommandRunner
|
||||
|
||||
@event_types [
|
||||
:app_init,
|
||||
:media_pre_download,
|
||||
:media_downloaded,
|
||||
:media_deleted
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ defmodule Pinchflat.Release do
|
|||
[
|
||||
"/config",
|
||||
"/downloads",
|
||||
"/etc/yt-dlp",
|
||||
"/etc/yt-dlp/plugins",
|
||||
Application.get_env(:pinchflat, :media_directory),
|
||||
Application.get_env(:pinchflat, :tmpfile_directory),
|
||||
Application.get_env(:pinchflat, :extras_directory),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue