Source attributes in output template (#45)

* Updated download options to take a media item; allowed for specifying custom output path template options

* Fixed bug where indexing job wouldn't run for the first time

* Renamed friendly_name to custom_name

* Added new options to default template and UI

* Improved explainer UI
This commit is contained in:
Kieran
2024-03-02 12:15:10 -08:00
committed by GitHub
parent 9e75092876
commit 09448e3fcc
18 changed files with 200 additions and 139 deletions
@@ -17,7 +17,7 @@
<section>
<strong>Source:</strong>
<.inline_link href={~p"/sources/#{@media_item.source_id}"}>
<%= @media_item.source.friendly_name %>
<%= @media_item.source.custom_name %>
</.inline_link>
</section>
@@ -30,7 +30,13 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do
end
def custom_output_template_options do
~w(upload_day upload_month upload_year)a
%{
upload_day: nil,
upload_month: nil,
upload_year: nil,
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'"
}
end
def common_output_template_options do
@@ -46,8 +46,8 @@
</section>
<h2 class="text-xl font-bold mb-2">Template Options</h2>
<section class="ml-2 md:ml-4 mb-4 max-w-prose">
<p>
<section class="ml-2 md:ml-4 mb-4">
<p class="max-w-prose">
Any single-word <code class="text-sm">yt-dlp</code>
option
<.inline_link href="https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#output-template">
@@ -58,8 +58,9 @@
</p>
<h3 class="text-lg font-bold mb-2">Custom Aliases</h3>
<ul class="list-disc list-inside ml-2 md:ml-5">
<li :for={opt <- custom_output_template_options()}>
<.inline_code>{{ <%= opt %> }}</.inline_code>
<li :for={{k, v} <- custom_output_template_options()}>
<.inline_code>{{ <%= k %> }}</.inline_code>
<span :if={v}>- <%= v %></span>
</li>
</ul>
<h3 class="text-lg font-bold mb-2">Common Options</h3>
@@ -50,7 +50,7 @@
<:tab title="Sources">
<.table rows={@media_profile.sources} table_class="text-black dark:text-white">
<:col :let={source} label="Name">
<%= source.friendly_name || source.collection_name %>
<%= source.custom_name || source.collection_name %>
</:col>
<:col :let={source} label="Type"><%= source.collection_type %></:col>
<:col :let={source} label="Should Download?">
@@ -14,7 +14,7 @@
<div class="flex flex-col gap-10 min-w-max">
<.table rows={@sources} table_class="text-black dark:text-white">
<:col :let={source} label="Name">
<%= source.friendly_name || source.collection_name %>
<%= source.custom_name || source.collection_name %>
</:col>
<:col :let={source} label="Type"><%= source.collection_type %></:col>
<:col :let={source} label="Should Download?">
@@ -4,7 +4,7 @@
</.error>
<.input
field={f[:friendly_name]}
field={f[:custom_name]}
type="text"
label="Custom Name"
help="Something descriptive. Does not impact indexing or downloading"