diff --git a/lib/pinchflat/downloading/download_option_builder.ex b/lib/pinchflat/downloading/download_option_builder.ex index 3e044721..333d1d5e 100644 --- a/lib/pinchflat/downloading/download_option_builder.ex +++ b/lib/pinchflat/downloading/download_option_builder.ex @@ -127,11 +127,12 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do defp quality_options(media_profile) do vcodec = Settings.get!(:video_codec_preference) acodec = Settings.get!(:audio_codec_preference) + container = media_profile.media_container case media_profile.preferred_resolution do # Also be aware that :audio disabled all embedding options for subtitles :audio -> - [:extract_audio, format_sort: "+acodec:#{acodec}"] + [:extract_audio, format_sort: "+acodec:#{acodec}", audio_format: container || "best"] resolution_atom -> {resolution_string, _} = @@ -141,7 +142,7 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do [ # Since Plex doesn't support reading metadata from MKV - remux_video: "mp4", + remux_video: container || "mp4", format_sort: "res:#{resolution_string},+codec:#{vcodec}:#{acodec}" ] end diff --git a/lib/pinchflat/profiles/media_profile.ex b/lib/pinchflat/profiles/media_profile.ex index da86df39..3158bdfc 100644 --- a/lib/pinchflat/profiles/media_profile.ex +++ b/lib/pinchflat/profiles/media_profile.ex @@ -27,6 +27,7 @@ defmodule Pinchflat.Profiles.MediaProfile do shorts_behaviour livestream_behaviour preferred_resolution + media_container redownload_delay_days marked_for_deletion_at )a @@ -65,6 +66,7 @@ defmodule Pinchflat.Profiles.MediaProfile do field :shorts_behaviour, Ecto.Enum, values: ~w(include exclude only)a, default: :include field :livestream_behaviour, Ecto.Enum, values: ~w(include exclude only)a, default: :include field :preferred_resolution, Ecto.Enum, values: ~w(4320p 2160p 1080p 720p 480p 360p audio)a, default: :"1080p" + field :media_container, :string, default: nil field :marked_for_deletion_at, :utc_datetime 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 a088aaa6..778d6747 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 @@ -1,4 +1,10 @@ -<.simple_form :let={f} for={@changeset} action={@action}> +<.simple_form + :let={f} + for={@changeset} + action={@action} + x-data="{ advancedMode: !!JSON.parse(localStorage.getItem('advancedMode')) }" + x-init="$watch('advancedMode', value => localStorage.setItem('advancedMode', JSON.stringify(value)))" +> <.error :if={@changeset.action}> Oops, something went wrong! Please check the errors below. @@ -30,10 +36,14 @@ -