Added presets for output templates
This commit is contained in:
parent
25eb772896
commit
1b41b0e0c7
4 changed files with 64 additions and 25 deletions
|
|
@ -40,7 +40,9 @@ defmodule Pinchflat.Downloading.OutputPathBuilder do
|
||||||
"upload_year" => "%(upload_date>%Y)S",
|
"upload_year" => "%(upload_date>%Y)S",
|
||||||
"upload_month" => "%(upload_date>%m)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-%m-%d)S"
|
"upload_yyyy_mm_dd" => "%(upload_date>%Y-%m-%d)S",
|
||||||
|
"season_from_date" => "%(upload_date>%Y)S",
|
||||||
|
"season_episode_from_date" => "s%(upload_date>%Y)Se%(upload_date>%m%d)S"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -317,17 +317,7 @@ defmodule PinchflatWeb.CoreComponents do
|
||||||
<span :if={@label_suffix} class="text-xs text-bodydark"><%= @label_suffix %></span>
|
<span :if={@label_suffix} class="text-xs text-bodydark"><%= @label_suffix %></span>
|
||||||
</.label>
|
</.label>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<input type="hidden" name={@name} value="false" />
|
<input type="hidden" id={@id} name={@name} x-bind:value="enabled" />
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
id={@id}
|
|
||||||
name={@name}
|
|
||||||
value="true"
|
|
||||||
x-bind:checked="enabled"
|
|
||||||
class="sr-only"
|
|
||||||
@change="enabled = !enabled"
|
|
||||||
{@rest}
|
|
||||||
/>
|
|
||||||
<div class="inline-block cursor-pointer" @click="enabled = !enabled">
|
<div class="inline-block cursor-pointer" @click="enabled = !enabled">
|
||||||
<div x-bind:class="enabled && '!bg-primary'" class="block h-8 w-14 rounded-full bg-black"></div>
|
<div x-bind:class="enabled && '!bg-primary'" class="block h-8 w-14 rounded-full bg-black"></div>
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do
|
defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do
|
||||||
use PinchflatWeb, :html
|
use PinchflatWeb, :html
|
||||||
|
|
||||||
|
alias Pinchflat.Profiles.MediaProfile
|
||||||
|
|
||||||
embed_templates "media_profile_html/*"
|
embed_templates "media_profile_html/*"
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
@ -53,4 +55,24 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do
|
||||||
duration_string
|
duration_string
|
||||||
)a
|
)a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def output_template_preset_options do
|
||||||
|
[
|
||||||
|
{"Default", default_output_template()},
|
||||||
|
{"Media Center (Plex, Jellyfin, Kodi, etc.)", media_center_output_template()},
|
||||||
|
{"Audio", audio_output_template()}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
defp default_output_template do
|
||||||
|
%MediaProfile{}.output_path_template
|
||||||
|
end
|
||||||
|
|
||||||
|
defp media_center_output_template do
|
||||||
|
"/shows/{{ source_custom_name }}/{{ season_from_date }}/{{ season_episode_from_date }} - {{ title }}.{{ ext }}"
|
||||||
|
end
|
||||||
|
|
||||||
|
defp audio_output_template do
|
||||||
|
"/music/{{ source_custom_name }}/{{ title }}.{{ ext }}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Oops, something went wrong! Please check the errors below.
|
Oops, something went wrong! Please check the errors below.
|
||||||
</.error>
|
</.error>
|
||||||
|
|
||||||
<h3 class="my-4 text-2xl text-black dark:text-white">
|
<h3 class="mt-4 text-2xl text-black dark:text-white">
|
||||||
General Options
|
General Options
|
||||||
</h3>
|
</h3>
|
||||||
<.input
|
<.input
|
||||||
|
|
@ -14,15 +14,40 @@
|
||||||
help="Something descriptive. Does not impact indexing or downloading (required)"
|
help="Something descriptive. Does not impact indexing or downloading (required)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<.input
|
<h3 class="mt-10 text-2xl text-black dark:text-white">
|
||||||
field={f[:output_path_template]}
|
Output Path Options
|
||||||
type="text"
|
</h3>
|
||||||
inputclass="font-mono"
|
|
||||||
label="Output path template"
|
|
||||||
help="Must end with .{{ ext }}. See below for more details. The default is good for most cases (required)"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
<section
|
||||||
|
class="flex flex-col lg:flex-row lg:justify-between"
|
||||||
|
x-data={"{ template: '#{f[:output_path_template].value}' }"}
|
||||||
|
>
|
||||||
|
<div class="w-full lg:w-9/12">
|
||||||
|
<.input
|
||||||
|
field={f[:output_path_template]}
|
||||||
|
type="text"
|
||||||
|
inputclass="font-mono"
|
||||||
|
label="Output path template"
|
||||||
|
help="Must end with .{{ ext }}. See below for more details. The default is good for most cases (required)"
|
||||||
|
x-model="template"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<span class="text-bodydark mt-6 lg:mt-15 text-2xl lg:text-lg">- or -</span>
|
||||||
|
</div>
|
||||||
|
<div class="w-full lg:w-2/12">
|
||||||
|
<.input
|
||||||
|
name="output_path_presets"
|
||||||
|
value="default"
|
||||||
|
options={output_template_preset_options()}
|
||||||
|
type="select"
|
||||||
|
label="Select preset"
|
||||||
|
x-on:change="template = event.target.value"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<h3 class="mt-10 text-2xl text-black dark:text-white">
|
||||||
Subtitle Options
|
Subtitle Options
|
||||||
</h3>
|
</h3>
|
||||||
<.input
|
<.input
|
||||||
|
|
@ -50,7 +75,7 @@
|
||||||
help="Use commas for multiple languages (eg: en,de)"
|
help="Use commas for multiple languages (eg: en,de)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
<h3 class="mt-10 text-2xl text-black dark:text-white">
|
||||||
Thumbnail Options
|
Thumbnail Options
|
||||||
</h3>
|
</h3>
|
||||||
<.input
|
<.input
|
||||||
|
|
@ -66,7 +91,7 @@
|
||||||
help="Downloads and embeds thumbnail in the media file itself, if supported. Uneffected by 'Download Thumbnail' (recommended)"
|
help="Downloads and embeds thumbnail in the media file itself, if supported. Uneffected by 'Download Thumbnail' (recommended)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
<h3 class="mt-10 text-2xl text-black dark:text-white">
|
||||||
Metadata Options
|
Metadata Options
|
||||||
</h3>
|
</h3>
|
||||||
<.input
|
<.input
|
||||||
|
|
@ -88,7 +113,7 @@
|
||||||
help="Downloads NFO data alongside media file for use with Jellyfin, Kodi, etc."
|
help="Downloads NFO data alongside media file for use with Jellyfin, Kodi, etc."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
<h3 class="mt-10 text-2xl text-black dark:text-white">
|
||||||
Release Format Options
|
Release Format Options
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
|
@ -107,7 +132,7 @@
|
||||||
help="Excludes media that comes from a past livestream"
|
help="Excludes media that comes from a past livestream"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
<h3 class="mt-10 text-2xl text-black dark:text-white">
|
||||||
Quality Options
|
Quality Options
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue