From ec61b1684a9873d43e352c2580898e2373771e17 Mon Sep 17 00:00:00 2001 From: dev Date: Sun, 10 May 2026 12:05:10 +0200 Subject: [PATCH] feat: set MKV internal title to "Artist - Concert (year)" Co-Authored-By: Claude Sonnet 4.6 --- downloader.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/downloader.py b/downloader.py index 63c6e8f..e4e42cc 100644 --- a/downloader.py +++ b/downloader.py @@ -198,6 +198,10 @@ class DownloadManager: versions = get_versions(pid_m.group(1)) 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. # After the first stream finishes, stay in "processing" to avoid # resetting progress to 0% when the audio stream starts. @@ -219,10 +223,13 @@ class DownloadManager: finished_once[0] = True self._set(dl_id, state="processing", progress=100) + ffmpeg_out = ["-metadata", f"title={mkv_title}"] + ydl_opts = { "outtmpl": f"{out_dir}/%(title)s.%(ext)s", "format": "bestvideo[vcodec^=avc1]+bestaudio/bestvideo+bestaudio/best", "merge_output_format": "mkv", + "postprocessor_args": {"ffmpeg_o": ffmpeg_out}, "progress_hooks": [hook], "quiet": True, "no_warnings": True, @@ -232,9 +239,9 @@ class DownloadManager: "writesubtitles": True, "subtitleslangs": ["fr"], "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: with yt_dlp.YoutubeDL(ydl_opts) as ydl: