diff --git a/lib/pinchflat/sources/source.ex b/lib/pinchflat/sources/source.ex index 6282e28..69f1fab 100644 --- a/lib/pinchflat/sources/source.ex +++ b/lib/pinchflat/sources/source.ex @@ -17,6 +17,7 @@ defmodule Pinchflat.Sources.Source do collection_type custom_name index_frequency_minutes + fast_index download_media last_indexed_at original_url @@ -29,6 +30,7 @@ defmodule Pinchflat.Sources.Source do collection_type custom_name index_frequency_minutes + fast_index download_media original_url media_profile_id @@ -40,6 +42,7 @@ defmodule Pinchflat.Sources.Source do field :collection_id, :string field :collection_type, Ecto.Enum, values: [:channel, :playlist] field :index_frequency_minutes, :integer, default: 60 * 24 + field :fast_index, :boolean, default: false field :download_media, :boolean, default: true field :last_indexed_at, :utc_datetime # This should only be used for user reference going forward diff --git a/lib/pinchflat_web/controllers/sources/source_html/fast_indexing_help.html.heex b/lib/pinchflat_web/controllers/sources/source_html/fast_indexing_help.html.heex new file mode 100644 index 0000000..710b2ed --- /dev/null +++ b/lib/pinchflat_web/controllers/sources/source_html/fast_indexing_help.html.heex @@ -0,0 +1,21 @@ + diff --git a/lib/pinchflat_web/controllers/sources/source_html/source_form.html.heex b/lib/pinchflat_web/controllers/sources/source_html/source_form.html.heex index c538c96..8124106 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/source_form.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/source_form.html.heex @@ -3,6 +3,10 @@ Oops, something went wrong! Please check the errors below. +

+ General Options +

+ <.input field={f[:custom_name]} type="text" @@ -19,6 +23,10 @@ label="Media Profile" /> +

+ Indexing Options +

+ <.input field={f[:index_frequency_minutes]} options={friendly_index_frequencies()} @@ -27,6 +35,18 @@ help="Time between one index of this source finishing and the next one starting. Setting to 'On Create' will still run an initial index but no subsequent ones" /> + <%!-- TODO: use Alpine to disable the index frequency when fast indexing is enabled --%> + <.input + field={f[:fast_index]} + type="toggle" + label="Use Fast Indexing?" + help="Experimental. Ignores 'Index Frequency'. Recommended for large channels that upload frequently. See below for more info" + /> + +

+ Downloading Options +

+ <.input field={f[:download_media]} type="toggle" @@ -34,7 +54,9 @@ help="Unchecking still indexes media but it won't be downloaded until you enable this option" /> - <:actions> - <.button class="my-10 sm:mb-7.5 w-full sm:w-auto">Save Source - + <.button class="my-10 sm:mb-7.5 w-full sm:w-auto">Save Source + +
+ <.fast_indexing_help /> +
diff --git a/priv/repo/migrations/20240309182418_add_fast_index_to_sources.exs b/priv/repo/migrations/20240309182418_add_fast_index_to_sources.exs new file mode 100644 index 0000000..26b3a6c --- /dev/null +++ b/priv/repo/migrations/20240309182418_add_fast_index_to_sources.exs @@ -0,0 +1,9 @@ +defmodule Pinchflat.Repo.Migrations.AddFastIndexToSources do + use Ecto.Migration + + def change do + alter table(:sources) do + add :fast_index, :boolean, null: false, default: false + end + end +end