fix(spotify): use ' / ' as artist separator for Navidrome multi-artist splitting
Navidrome splits artist tags on '/' (Tags.artist.Split = ["/"]). Using ' / ' between multiple artists (both from array format and from Spotify's comma-separated subtitle) lets Navidrome register them as separate artists without any config change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f0cb899ed
commit
a5e38e64cf
1 file changed
+4
-2
@@ -439,7 +439,8 @@ function _spAllArtists(artistsRaw) {
|
|||||||
if (!artistsRaw) return '';
|
if (!artistsRaw) return '';
|
||||||
// Handle both array format and GraphQL {items:[...]} format
|
// Handle both array format and GraphQL {items:[...]} format
|
||||||
const arr = Array.isArray(artistsRaw) ? artistsRaw : (artistsRaw.items || []);
|
const arr = Array.isArray(artistsRaw) ? artistsRaw : (artistsRaw.items || []);
|
||||||
return arr.map(a => a?.profile?.name || a?.name || '').filter(Boolean).join(', ');
|
// Use " / " so Navidrome splits on "/" into multiple artists
|
||||||
|
return arr.map(a => a?.profile?.name || a?.name || '').filter(Boolean).join(' / ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function _spArtistName(artistsRaw) {
|
function _spArtistName(artistsRaw) {
|
||||||
@@ -461,7 +462,8 @@ function _spTrackItem(t, defaultAlbum, defaultArt, defaultAlbumArtist) {
|
|||||||
if (d?.artists) {
|
if (d?.artists) {
|
||||||
artist = _spAllArtists(d.artists);
|
artist = _spAllArtists(d.artists);
|
||||||
} else if (typeof d?.subtitle === 'string' && d.subtitle) {
|
} else if (typeof d?.subtitle === 'string' && d.subtitle) {
|
||||||
artist = d.subtitle;
|
// Spotify subtitle separates artists with ", " — convert to " / " for Navidrome splitting
|
||||||
|
artist = d.subtitle.replace(/,\s*/g, ' / ');
|
||||||
}
|
}
|
||||||
artist = artist || defaultAlbumArtist || '';
|
artist = artist || defaultAlbumArtist || '';
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user