fix: split multi-artist tags from yt-dlp downloads into separate artists - #444
fix: split multi-artist tags from yt-dlp downloads into separate artists#444firatege wants to merge 2 commits into
Conversation
yt-dlp embeds multiple artists as one comma-joined artist tag (e.g. "Kero Kero Bonito, Douglas Lobban, Sarah Perry"). The library scanner only splits artists on ';', and the singular artist field kept the whole joined string, which leaked into the album-artist fallback and showed up as a single phantom artist in the library. Three changes: * ytdlp downloads: record yt-dlp's structured artists list per finished file (--print-to-file manifest) and rewrite the tag joined with ';'. Working from the structured list avoids comma guessing, so a name like "Tyler, The Creator" stays intact. Best-effort: a failed rewrite only logs and the file keeps yt-dlp's own tag. * scanner: the singular artist field is now the primary (first) credited artist, matching what the YT Music streaming path already does. The full list stays in track.artists. * Jellyfin sync: the artist fallback uses the first artist instead of comma-joining the list (same phantom pattern, different path). Covered by reader integration tests with generated opus fixtures and ytdlp manifest unit tests; verified end to end with the album from the issue. Closes Kopuz-org#314
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds structured multi-artist support for yt-dlp downloads. The reader crate gains a ChangesMulti-artist tag rewrite
Sequence Diagram(s)sequenceDiagram
participant DownloadTask
participant YtDlp
participant ManifestFile
participant TagRewriter
participant AudioFile
DownloadTask->>YtDlp: start download with manifest output path
YtDlp->>ManifestFile: write artists JSON and output path lines
YtDlp-->>DownloadTask: report successful completion
DownloadTask->>TagRewriter: apply artist manifest
TagRewriter->>ManifestFile: read manifest lines
TagRewriter->>AudioFile: rewrite artist tag from structured artists
DownloadTask->>ManifestFile: remove temporary manifest file
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #314. Tracks downloaded from YouTube Music with multiple credited artists ended up as a single phantom artist in the library (e.g.
Kero Kero Bonito, Douglas Lobban, Sarah Perryas one entry).Root cause
Two layers:
artisttag. The scanner only splits artists on;, so the joined string stayed in one piece.artistfield kept the whole joined string, and the album-artist fallback (album.artist) inherits it. The artists page builds its list from bothtrack.artistsandalbum.artist, so the phantom persisted either way (caught by the new integration tests).Changes
pages/ytdlp.rs: when--embed-metadatais on, record yt-dlp's structuredartistslist per finished file via--print-to-file "after_move:%(artists)j\t%(filepath)s", then rewrite the tag joined with;(which the scanner already splits). Working from the structured list instead of guessing on commas means a name likeTyler, The Creator(list of one) is left untouched, and extractors without anartistslist fall back to current behavior. Best-effort: a failed rewrite only logs, the download never fails because of it.reader/metadata.rs: the singularartistfield is now the primary (first) credited artist — same as the YT Music streaming path (search.rs) already does. The full list stays intrack.artists. Also addsset_artist_tag()used by the rewrite above.Tests
crates/reader/tests/artist_parsing.rs+ tiny generated silent opus fixtures (~550 bytes each): single artist unchanged,;tag splits with primary artist, comma tag is not guessed, comma-in-name stays intact, explicitALBUMARTISTwins.pages::ytdlpunit tests: manifest line parsing (incl.null/NAextractors) and the tag rewrite incl. the single-artist skip.Verified end to end
Downloaded the album from the issue with the patched build:
Artists page now lists the three artists separately, no phantom entry.
Closes #314
Summary by CodeRabbit
Release Notes
New Features
Tests