Added new script type to pre-job startup tasks
This commit is contained in:
parent
83c10b2b00
commit
e98fe97f1f
2 changed files with 11 additions and 0 deletions
|
|
@ -16,6 +16,8 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
||||||
alias Pinchflat.Settings
|
alias Pinchflat.Settings
|
||||||
alias Pinchflat.Utils.FilesystemUtils
|
alias Pinchflat.Utils.FilesystemUtils
|
||||||
|
|
||||||
|
alias Pinchflat.Lifecycle.UserScripts.CommandRunner, as: UserScriptRunner
|
||||||
|
|
||||||
def start_link(opts \\ []) do
|
def start_link(opts \\ []) do
|
||||||
GenServer.start_link(__MODULE__, %{}, opts)
|
GenServer.start_link(__MODULE__, %{}, opts)
|
||||||
end
|
end
|
||||||
|
|
@ -36,6 +38,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
||||||
create_blank_yt_dlp_files()
|
create_blank_yt_dlp_files()
|
||||||
create_blank_user_script_file()
|
create_blank_user_script_file()
|
||||||
apply_default_settings()
|
apply_default_settings()
|
||||||
|
run_app_init_script()
|
||||||
|
|
||||||
{:ok, state}
|
{:ok, state}
|
||||||
end
|
end
|
||||||
|
|
@ -95,6 +98,13 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do
|
||||||
Settings.set(apprise_version: apprise_version)
|
Settings.set(apprise_version: apprise_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: test
|
||||||
|
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
|
defp yt_dlp_runner do
|
||||||
Application.get_env(:pinchflat, :yt_dlp_runner)
|
Application.get_env(:pinchflat, :yt_dlp_runner)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ defmodule Pinchflat.Lifecycle.UserScripts.CommandRunner do
|
||||||
@behaviour UserScriptCommandRunner
|
@behaviour UserScriptCommandRunner
|
||||||
|
|
||||||
@event_types [
|
@event_types [
|
||||||
|
:app_init,
|
||||||
:media_pre_download,
|
:media_pre_download,
|
||||||
:media_downloaded,
|
:media_downloaded,
|
||||||
:media_deleted
|
:media_deleted
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue