[Feature] Add SponsorBlock-based section removal (#144)

* Added sponsorblock columns to media profile

* Added sponsorblock options to profile form

* Added SB to download options builder
This commit is contained in:
Kieran authored and GitHub committed 2024-03-28 19:02:13 -07:00
1 parent 216e05567f
commit 964ab2f89b
7 files changed
+147 -1

No files matched your search

@@ -22,6 +22,7 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do
thumbnail_options(media_item_with_preloads) ++
metadata_options(media_profile) ++
quality_options(media_profile) ++
sponsorblock_options(media_profile) ++
output_options(media_item_with_preloads)
{:ok, built_options}
@@ -116,6 +117,17 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do
end
end
defp sponsorblock_options(media_profile) do
categories = media_profile.sponsorblock_categories
behaviour = media_profile.sponsorblock_behaviour
case {behaviour, categories} do
{_, []} -> []
{:remove, _} -> [sponsorblock_remove: Enum.join(categories, ",")]
{:disabled, _} -> []
end
end
defp output_options(media_item_with_preloads) do
[
output: build_output_path_for(media_item_with_preloads.source)