fix: apply romaji overrides in dispArtist/dispAlbum/dispTitle display functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-06-05 00:50:06 +02:00
1 parent a8e54b3a41
commit 1277913ac1
1 file changed
+11
+11
View File
@@ -124,16 +124,24 @@ export function romajiLookup(id) { return _romajiMap?.get(String(id)) ?? null; }
// Display helpers — return romaji when showRomaji is on and the song is in the index, // Display helpers — return romaji when showRomaji is on and the song is in the index,
// otherwise fall back to the original Navidrome values. // otherwise fall back to the original Navidrome values.
// Overrides (localStorage) always take priority over auto-converted index values.
export function dispTitle(s) { export function dispTitle(s) {
if (!S.cfg.showRomaji) return s.title || ''; if (!S.cfg.showRomaji) return s.title || '';
const ov = getRomajiOverrides();
if (s.title && ov[s.title]) return ov[s.title];
return romajiLookup(s.id)?.titleRomaji || s.title || ''; return romajiLookup(s.id)?.titleRomaji || s.title || '';
} }
export function dispArtist(s) { export function dispArtist(s) {
if (!S.cfg.showRomaji) return s.artist || ''; if (!S.cfg.showRomaji) return s.artist || '';
const ov = getRomajiOverrides();
if (s.artist && ov[s.artist]) return ov[s.artist];
if (s.albumArtist && ov[s.albumArtist]) return ov[s.albumArtist];
return romajiLookup(s.id)?.artistRomaji || s.artist || ''; return romajiLookup(s.id)?.artistRomaji || s.artist || '';
} }
export function dispAlbum(s) { export function dispAlbum(s) {
if (!S.cfg.showRomaji) return s.album || ''; if (!S.cfg.showRomaji) return s.album || '';
const ov = getRomajiOverrides();
if (s.album && ov[s.album]) return ov[s.album];
return romajiLookup(s.id)?.albumRomaji || s.album || ''; return romajiLookup(s.id)?.albumRomaji || s.album || '';
} }
// Returns [{name, id}] like parseArtists but with romaji display names when showRomaji is on. // Returns [{name, id}] like parseArtists but with romaji display names when showRomaji is on.
@@ -141,6 +149,9 @@ export function dispAlbum(s) {
export function dispArtistParts(s, parseArtistsFn) { export function dispArtistParts(s, parseArtistsFn) {
const parts = parseArtistsFn(s); const parts = parseArtistsFn(s);
if (!S.cfg.showRomaji) return parts; if (!S.cfg.showRomaji) return parts;
const ov = getRomajiOverrides();
if (s.artist && ov[s.artist]) return [{ name: ov[s.artist], id: parts[0]?.id || '' }];
if (s.albumArtist && ov[s.albumArtist]) return [{ name: ov[s.albumArtist], id: parts[0]?.id || '' }];
const info = romajiLookup(s.id); const info = romajiLookup(s.id);
if (!info?.artistRomaji) return parts; if (!info?.artistRomaji) return parts;
return [{ name: info.artistRomaji, id: parts[0]?.id || '' }]; return [{ name: info.artistRomaji, id: parts[0]?.id || '' }];