feat: set MKV internal title to "Artist - Concert (year)"
Docker / docker (push) Successful in 1m23s
Docker / docker (push) Successful in 1m23s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+9
-2
@@ -198,6 +198,10 @@ class DownloadManager:
|
|||||||
versions = get_versions(pid_m.group(1))
|
versions = get_versions(pid_m.group(1))
|
||||||
lang_tag = select_lang_tag(versions)
|
lang_tag = select_lang_tag(versions)
|
||||||
|
|
||||||
|
# MKV internal title: "Artist - Concert Title (year)"
|
||||||
|
name_part = f"{title} - {subtitle}" if subtitle else title
|
||||||
|
mkv_title = f"{name_part} ({year})" if year else name_part
|
||||||
|
|
||||||
# For HLS, yt-dlp downloads video then audio separately.
|
# For HLS, yt-dlp downloads video then audio separately.
|
||||||
# After the first stream finishes, stay in "processing" to avoid
|
# After the first stream finishes, stay in "processing" to avoid
|
||||||
# resetting progress to 0% when the audio stream starts.
|
# resetting progress to 0% when the audio stream starts.
|
||||||
@@ -219,10 +223,13 @@ class DownloadManager:
|
|||||||
finished_once[0] = True
|
finished_once[0] = True
|
||||||
self._set(dl_id, state="processing", progress=100)
|
self._set(dl_id, state="processing", progress=100)
|
||||||
|
|
||||||
|
ffmpeg_out = ["-metadata", f"title={mkv_title}"]
|
||||||
|
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
"outtmpl": f"{out_dir}/%(title)s.%(ext)s",
|
"outtmpl": f"{out_dir}/%(title)s.%(ext)s",
|
||||||
"format": "bestvideo[vcodec^=avc1]+bestaudio/bestvideo+bestaudio/best",
|
"format": "bestvideo[vcodec^=avc1]+bestaudio/bestvideo+bestaudio/best",
|
||||||
"merge_output_format": "mkv",
|
"merge_output_format": "mkv",
|
||||||
|
"postprocessor_args": {"ffmpeg_o": ffmpeg_out},
|
||||||
"progress_hooks": [hook],
|
"progress_hooks": [hook],
|
||||||
"quiet": True,
|
"quiet": True,
|
||||||
"no_warnings": True,
|
"no_warnings": True,
|
||||||
@@ -232,9 +239,9 @@ class DownloadManager:
|
|||||||
"writesubtitles": True,
|
"writesubtitles": True,
|
||||||
"subtitleslangs": ["fr"],
|
"subtitleslangs": ["fr"],
|
||||||
"embedsubtitles": True,
|
"embedsubtitles": True,
|
||||||
# Set first subtitle track as default in MKV
|
|
||||||
"postprocessor_args": {"ffmpeg_o": ["-disposition:s:0", "default"]},
|
|
||||||
})
|
})
|
||||||
|
# Append disposition after title metadata
|
||||||
|
ffmpeg_out += ["-disposition:s:0", "default"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
|
|||||||
Reference in New Issue
Block a user