Context
Right now, mp3 downloads only get the raw filename (%(title).60s.%(ext)s) — no ID3 tags are written, so title/artist show up empty in any music player/library manager. Since yt-dlp already knows this metadata from the video info, it seems worth writing it into the file at download time.
Proposal
Add three yt-dlp flags to the audio choice's args in buildChoices():
args: [
'-f', 'ba/b', '-x', '--audio-format', 'mp3', '--audio-quality', '0',
'--parse-metadata', 'title:(?P<artist>.+?) - (?P<title>.+)',
'--embed-metadata',
'--embed-thumbnail',
]
--parse-metadata splits the video title into artist/title when it follows the "Artist - Title" pattern (common on YouTube). Falls through silently otherwise.
--embed-metadata writes title/artist/uploader as fallback into the mp3's ID3 tags — even without the split above, this alone fixes "empty title" in players.
--embed-thumbnail embeds the video's thumbnail as album cover art (requires ffmpeg, which is already a hard requirement for mp3 extraction).
Tested locally on a few YouTube videos (both "Artist - Title" and plain-title cases) — works well, tags and cover show up correctly in eyeD3/music players.
Open question
Should this be the default behavior for all mp3 downloads, or gated behind an opt-in flag (e.g. --tag)? I lean toward "just do it by default" since it's strictly additive (no existing behavior is removed, just extra metadata written), but wanted to check your take before polishing a PR — happy to adjust either way.
Also open to feedback on the --parse-metadata regex if there's a better heuristic for splitting artist/title.
Context
Right now, mp3 downloads only get the raw filename (
%(title).60s.%(ext)s) — no ID3 tags are written, so title/artist show up empty in any music player/library manager. Since yt-dlp already knows this metadata from the video info, it seems worth writing it into the file at download time.Proposal
Add three yt-dlp flags to the audio choice's args in
buildChoices():--parse-metadatasplits the video title into artist/title when it follows the "Artist - Title" pattern (common on YouTube). Falls through silently otherwise.--embed-metadatawrites title/artist/uploader as fallback into the mp3's ID3 tags — even without the split above, this alone fixes "empty title" in players.--embed-thumbnailembeds the video's thumbnail as album cover art (requires ffmpeg, which is already a hard requirement for mp3 extraction).Tested locally on a few YouTube videos (both "Artist - Title" and plain-title cases) — works well, tags and cover show up correctly in
eyeD3/music players.Open question
Should this be the default behavior for all mp3 downloads, or gated behind an opt-in flag (e.g.
--tag)? I lean toward "just do it by default" since it's strictly additive (no existing behavior is removed, just extra metadata written), but wanted to check your take before polishing a PR — happy to adjust either way.Also open to feedback on the
--parse-metadataregex if there's a better heuristic for splitting artist/title.