Adds UI for audio_track to the media profile form

This commit is contained in:
Kieran Eglin 2024-11-27 10:23:05 -08:00
parent fa22580094
commit a2cc4e78ff
No known key found for this signature in database
GPG key ID: 193984967FCF432D
3 changed files with 15 additions and 2 deletions

View file

@ -54,8 +54,11 @@ defmodule Pinchflat.Downloading.QualityOptionBuilder do
end
end
# Reminder to self: this conflicts with `--extractor-args "youtube:lang=<LANG>"`
# since that will translate the format_notes as well, which means they may not match.
# At least that's what happens now - worth a re-check if I have to come back to this
defp build_format_modifier("original"), do: "format_note*=original"
defp build_format_modifier("default"), do: "format_note*=(default)"
defp build_format_modifier("default"), do: "format_note*='(default)'"
# This uses the carat to anchor the language to the beginning of the string
# since that's what's needed to match `en` to `en-US` and `en-GB`, etc. The user
# can always specify the full language code if they want.

View file

@ -125,6 +125,16 @@
/>
</section>
<section x-show="advancedMode">
<.input
field={f[:audio_track]}
placeholder="de"
type="text"
label="Audio Track Language"
help="Only works if there are multiple audio tracks. Use either a language code, 'original' for the original audio track, or 'default' for YouTube's preference. Or just leave it blank"
/>
</section>
<h3 class="mt-10 text-2xl text-black dark:text-white">
Thumbnail Options
</h3>

View file

@ -20,7 +20,7 @@ defmodule Pinchflat.Downloading.QualityOptionBuilderTest do
assert res = QualityOptionBuilder.build(media_profile)
assert {:format, "bestvideo+bestaudio[format_note*=(default)]/bestvideo*+bestaudio/best"} in res
assert {:format, "bestvideo+bestaudio[format_note*='(default)']/bestvideo*+bestaudio/best"} in res
end
test "includes format options if audio_track is set to a language code" do