fix: apply romaji overrides to album cards on home/albums/artist views

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-06-05 23:43:27 +02:00
1 parent 01407ef3f1
commit ccdcda74ec
2 files changed
+11 -4

No files matched your search

+9 -2
View File
@@ -136,8 +136,15 @@ export async function removeRomajiOverride(kanji) {
} }
export function dispArtistById(id, name) { export function dispArtistById(id, name) {
if (!S.cfg.showRomaji || !_artistRomajiMap) return name || ''; if (!S.cfg.showRomaji) return name || '';
return _artistRomajiMap.get(String(id)) || name || ''; const ov = getRomajiOverrides();
if (name && ov[name]) return ov[name];
return _artistRomajiMap?.get(String(id)) || name || '';
}
export function dispAlbumName(name) {
if (!S.cfg.showRomaji) return name || '';
const ov = getRomajiOverrides();
return ov[name] || name || '';
} }
// Synchronous lookup — returns index entry for a song ID, or null if not in index. // Synchronous lookup — returns index entry for a song ID, or null if not in index.
+2 -2
View File
@@ -8,7 +8,7 @@ window._imgRetry = function(img, fallback) {
if (n > 3 || !img.src) { img.parentNode.innerHTML = `<div class="no-art">${fallback}</div>`; return; } if (n > 3 || !img.src) { img.parentNode.innerHTML = `<div class="no-art">${fallback}</div>`; return; }
setTimeout(() => { const s = img.src; img.src = ''; img.src = s; }, 1500 * n); setTimeout(() => { const s = img.src; img.src = ''; img.src = s; }, 1500 * n);
}; };
import { coverUrl, dispTitle, dispArtistParts, dispAlbum } from './api.js'; import { coverUrl, dispTitle, dispArtistParts, dispAlbum, dispArtistById, dispAlbumName } from './api.js';
// Circular imports — safe (only used inside event handlers after module init) // Circular imports — safe (only used inside event handlers after module init)
import { playQueue, toggleStar, playPreview, parseArtists } from './player.js'; import { playQueue, toggleStar, playPreview, parseArtists } from './player.js';
import { showCtxMenu, openDlModal } from './ui.js'; import { showCtxMenu, openDlModal } from './ui.js';
@@ -28,7 +28,7 @@ export function makeCard(title, sub, imgUrl, fallback='💿') {
export function makeAlbumCard(a) { export function makeAlbumCard(a) {
const cv = coverUrl(a.coverArt, 512); const cv = coverUrl(a.coverArt, 512);
const c = makeCard(a.name, a.artist||'', cv, '💿'); const c = makeCard(dispAlbumName(a.name), dispArtistById(a.artistId, a.artist||''), cv, '💿');
c.querySelector('.card-art').onclick = (e) => { e.stopPropagation(); quickPlayAlbum(a); }; c.querySelector('.card-art').onclick = (e) => { e.stopPropagation(); quickPlayAlbum(a); };
c.querySelector('.card-info').onclick = () => navigate('album-detail', a); c.querySelector('.card-info').onclick = () => navigate('album-detail', a);
return c; return c;