diff --git a/lib/pinchflat/downloading/download_option_builder.ex b/lib/pinchflat/downloading/download_option_builder.ex index 0bafc2e1..3e044721 100644 --- a/lib/pinchflat/downloading/download_option_builder.ex +++ b/lib/pinchflat/downloading/download_option_builder.ex @@ -74,6 +74,9 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do {{:download_auto_subs, true}, %{download_subs: true}} -> acc ++ [:write_auto_subs] + {{:download_auto_subs, true}, %{embed_subs: true}} -> + acc ++ [:write_auto_subs] + {{:embed_subs, true}, %{preferred_resolution: pr}} when pr != :audio -> acc ++ [:embed_subs] 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 c30b3df3..a088aaa6 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 @@ -84,22 +84,22 @@ /> -
+
<.input - field={f[:download_auto_subs]} + field={f[:embed_subs]} type="toggle" - label="Download Autogenerated Subtitles" - help="Prefers normal subs but will download autogenerated if needed. Requires 'Download Subtitles' to be enabled" + label="Embed Subtitles" + help="Downloads and embeds subtitles in the media file itself, if supported. Uneffected by 'Download Subtitles'" x-init="$watch('selectedPreset', p => p && (enabled = presets[p]))" />
-
+
<.input - field={f[:embed_subs]} + field={f[:download_auto_subs]} type="toggle" - label="Embed Subtitles" - help="Downloads and embeds subtitles in the media file itself, if supported. Uneffected by 'Download Subtitles' (recommended)" + label="Use Autogenerated Subtitles" + help="Prefers normal subs with 'Download Subtitles' or 'Embed Subtitles' but will use autogenerated subs if needed." x-init="$watch('selectedPreset', p => p && (enabled = presets[p]))" />
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex index 45ecf4fd..e3a13001 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/output_template_help.html.heex @@ -60,14 +60,14 @@

Other Custom Aliases

Common Options

diff --git a/test/pinchflat/downloading/download_option_builder_test.exs b/test/pinchflat/downloading/download_option_builder_test.exs index d31c6c65..5670c388 100644 --- a/test/pinchflat/downloading/download_option_builder_test.exs +++ b/test/pinchflat/downloading/download_option_builder_test.exs @@ -93,15 +93,23 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilderTest do end test "includes :write_auto_subs option when specified", %{media_item: media_item} do - media_item = update_media_profile_attribute(media_item, %{download_subs: true, download_auto_subs: true}) + media_item_1 = update_media_profile_attribute(media_item, %{download_subs: true, download_auto_subs: true}) + media_item_2 = update_media_profile_attribute(media_item, %{embed_subs: true, download_auto_subs: true}) - assert {:ok, res} = DownloadOptionBuilder.build(media_item) + assert {:ok, res_1} = DownloadOptionBuilder.build(media_item_1) + assert {:ok, res_2} = DownloadOptionBuilder.build(media_item_2) - assert :write_auto_subs in res + assert :write_auto_subs in res_1 + assert :write_auto_subs in res_2 end - test "doesn't include :write_auto_subs option when download_subs is false", %{media_item: media_item} do - media_item = update_media_profile_attribute(media_item, %{download_subs: false, download_auto_subs: true}) + test "doesn't include :write_auto_subs option when download_subs and embed_subs is false", %{media_item: media_item} do + media_item = + update_media_profile_attribute(media_item, %{ + download_subs: false, + embed_subs: false, + download_auto_subs: true + }) assert {:ok, res} = DownloadOptionBuilder.build(media_item)