diff --git a/lib/pinchflat/sources/source.ex b/lib/pinchflat/sources/source.ex index 0ed8aaa..9b7f15d 100644 --- a/lib/pinchflat/sources/source.ex +++ b/lib/pinchflat/sources/source.ex @@ -21,6 +21,7 @@ defmodule Pinchflat.Sources.Source do download_media last_indexed_at original_url + download_cutoff_date media_profile_id )a @@ -45,8 +46,8 @@ defmodule Pinchflat.Sources.Source do 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 - # as the collection_id should be used for all API calls + # Only download media items that were published after this date + field :download_cutoff_date, :date field :original_url, :string belongs_to :media_profile, MediaProfile 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 5eff7c6..5c89574 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 @@ -57,6 +57,14 @@ help="Unchecking still indexes media but it won't be downloaded until you enable this option" /> + <.input + field={f[:download_cutoff_date]} + type="text" + label="Download Cutoff Date" + placeholder="YYYY-MM-DD" + help="Only download media uploaded after this date. Leave blank to download all media. Must be in YYYY-MM-DD format" + /> + <.button class="my-10 sm:mb-7.5 w-full sm:w-auto">Save Source
diff --git a/priv/repo/migrations/20240311033214_add_download_cutoff_date_to_sources.exs b/priv/repo/migrations/20240311033214_add_download_cutoff_date_to_sources.exs new file mode 100644 index 0000000..df23506 --- /dev/null +++ b/priv/repo/migrations/20240311033214_add_download_cutoff_date_to_sources.exs @@ -0,0 +1,9 @@ +defmodule Pinchflat.Repo.Migrations.AddDownloadCutoffDateToSources do + use Ecto.Migration + + def change do + alter table(:sources) do + add :download_cutoff_date, :date + end + end +end