diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex
index 1b9e05a..f124b16 100644
--- a/lib/pinchflat_web/components/core_components.ex
+++ b/lib/pinchflat_web/components/core_components.ex
@@ -251,7 +251,7 @@ defmodule PinchflatWeb.CoreComponents do
attr :type, :string,
default: "text",
values: ~w(checkbox color date datetime-local email file hidden month number password
- toggle range radio search select tel text textarea time url week)
+ checkbox_group toggle range radio search select tel text textarea time url week)
attr :field, Phoenix.HTML.FormField, doc: "a form field struct retrieved from the form, for example: @form[:email]"
@@ -304,6 +304,33 @@ defmodule PinchflatWeb.CoreComponents do
"""
end
+ def input(%{type: "checkbox_group"} = assigns) do
+ ~H"""
+
+ <.label for={@id}>
+ <%= @label %>
<%= @label_suffix %>
+
+
+ <.help :if={@help}><%= @help %>
+ <.error :for={msg <- @errors}><%= msg %>
+
+ """
+ end
+
def input(%{type: "toggle"} = assigns) do
assigns =
assign_new(assigns, :checked, fn ->
@@ -601,6 +628,10 @@ defmodule PinchflatWeb.CoreComponents do
_ ->
true
end)
+ |> Enum.map(fn
+ {k, v} when is_list(v) -> {k, Enum.join(v, ", ")}
+ rest -> rest
+ end)
assigns = assign(assigns, iterable_attributes: attrs)
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 159af46..8f4a67a 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html.ex
@@ -32,6 +32,26 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileHTML do
]
end
+ def friendly_sponsorblock_options do
+ [
+ {"Disabled (default)", "disabled"},
+ {"Remove Segments", "remove"}
+ ]
+ end
+
+ def frieldly_sponsorblock_categories do
+ [
+ {"Sponsor", "sponsor"},
+ {"Intro/Intermission", "intro"},
+ {"Outro/Credits", "outro"},
+ {"Self Promotion", "selfpromo"},
+ {"Preview/Recap", "preview"},
+ {"Filler Tangent", "filler"},
+ {"Interaction Reminder", "interaction"},
+ {"Non-music Section", "music_offtopic"}
+ ]
+ end
+
def custom_output_template_options do
%{
upload_day: nil,
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 66073dd..36d99cc 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
@@ -238,6 +238,36 @@
/>
+
+ SponsorBlock Options
+
+
+
+
+ <.input
+ field={f[:sponsorblock_behaviour]}
+ options={friendly_sponsorblock_options()}
+ type="select"
+ label="SponsorBlock Behaviour"
+ help="Action to take when SponsorBlock segments are found. 'Disabled' won't take any action"
+ x-model="sponsorblockBehaviour"
+ x-init="
+ sponsorblockBehaviour = $el.value
+ $watch('selectedPreset', p => p && ($el.value = presets[p]))
+ "
+ />
+
+
+
+ <.input
+ field={f[:sponsorblock_categories]}
+ options={frieldly_sponsorblock_categories()}
+ type="checkbox_group"
+ label="SponsorBlock Categories"
+ />
+
+
+
<.button class="my-10 sm:mb-7.5 w-full sm:w-auto" rounding="rounded-lg">Save Media profile