feat: convert feat./ft./featuring to / in artist tag for Navidrome split
Navidrome splits artist tags on "/" so "Drake / Rihanna" becomes two separate artist entries. navidromeArtist() converts iTunes featuring patterns before writing the ID3 artist tag. album_artist stays clean (main artist only) for correct album grouping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
934e4f3b47
commit
15959b45eb
1 file changed
+11
-1
@@ -56,6 +56,16 @@ function sanitize(s) {
|
||||
return (s || 'Unknown').replace(/[\\/:*?"<>|]/g, '_').trim().slice(0, 100);
|
||||
}
|
||||
|
||||
// Convert "Artist feat. B" / "Artist ft. B" / "Artist featuring B" → "Artist / B"
|
||||
// so Navidrome splits on "/" and lists each as a separate artist
|
||||
function navidromeArtist(name) {
|
||||
if (!name) return name;
|
||||
return name
|
||||
.replace(/\s+feat\.?\s+/gi, ' / ')
|
||||
.replace(/\s+ft\.?\s+/gi, ' / ')
|
||||
.replace(/\s+featuring\s+/gi, ' / ');
|
||||
}
|
||||
|
||||
function updateJob(id, update) {
|
||||
const job = jobs.get(id);
|
||||
if (job) jobs.set(id, { ...job, ...update, updatedAt: Date.now() });
|
||||
@@ -179,7 +189,7 @@ async function downloadTrack({ jobId, artist, albumArtist, title, album, year, t
|
||||
'-map_metadata', '-1', // strip all existing tags (removes blurry YT thumbnail)
|
||||
'-id3v2_version', '3',
|
||||
'-metadata', `title=${title}`,
|
||||
'-metadata', `artist=${artist}`,
|
||||
'-metadata', `artist=${navidromeArtist(artist)}`,
|
||||
'-metadata', `album_artist=${mainArtist}`,
|
||||
);
|
||||
if (album) ffArgs.push('-metadata', `album=${album}`);
|
||||
|
||||
Reference in new issue
Block a user