From 359a9acc680832f8f6042805033e1e9a919af7ee Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Mon, 11 Mar 2024 15:05:00 -0700 Subject: [PATCH] Added better upload date template placeholder --- lib/pinchflat/profiles/media_profile.ex | 2 +- lib/pinchflat/profiles/output_path_builder.ex | 3 ++- .../controllers/media_profiles/media_profile_html.ex | 1 + .../media_profile_html/media_profile_form.html.heex | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pinchflat/profiles/media_profile.ex b/lib/pinchflat/profiles/media_profile.ex index c8e3aee..fca3a94 100644 --- a/lib/pinchflat/profiles/media_profile.ex +++ b/lib/pinchflat/profiles/media_profile.ex @@ -30,7 +30,7 @@ defmodule Pinchflat.Profiles.MediaProfile do field :name, :string field :output_path_template, :string, - default: "/{{ source_custom_name }}/{{ title }}/{{ title }} [{{ id }}].{{ ext }}" + default: "/{{ source_custom_name }}/{{ upload_yyyy_mm_dd }} {{ title }}/{{ title }} [{{ id }}].{{ ext }}" field :download_subs, :boolean, default: true field :download_auto_subs, :boolean, default: true diff --git a/lib/pinchflat/profiles/output_path_builder.ex b/lib/pinchflat/profiles/output_path_builder.ex index 8ac62ef..de0b6b9 100644 --- a/lib/pinchflat/profiles/output_path_builder.ex +++ b/lib/pinchflat/profiles/output_path_builder.ex @@ -39,7 +39,8 @@ defmodule Pinchflat.Profiles.OutputPathBuilder do # Individual parts of the upload date "upload_year" => "%(upload_date>%Y)S", "upload_month" => "%(upload_date>%m)S", - "upload_day" => "%(upload_date>%d)S" + "upload_day" => "%(upload_date>%d)S", + "upload_yyyy_mm_dd" => "%(upload_date>%Y)S-%(upload_date>%m)S-%(upload_date>%d)S" } end end diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex index 3e23050..85990a4 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex @@ -35,6 +35,7 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do upload_day: nil, upload_month: nil, upload_year: nil, + upload_yyyy_mm_dd: "the upload date in the format YYYY-MM-DD", source_custom_name: "the name of the sources that use this profile", source_collection_type: "the collection type of the sources that use this profile. Either 'channel' or 'playlist'" } diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex index 5bb104b..e149ed0 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/media_profile_form.html.heex @@ -19,7 +19,7 @@ type="text" inputclass="font-mono" label="Output path template" - help="Must end with .{{ ext }}. See below for more details. I promise the default is good for most cases (required)" + help="Must end with .{{ ext }}. See below for more details. The default is good for most cases (required)" />