fix: dispArtistById prefers Navidrome sortName over kuromoji translation
Added _artistSortMap populated from getArtists (artist listing) and getArtist (artist detail) responses. dispArtistById now checks the Navidrome sort tag first, falls back to kuromoji only when missing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
da68afe0e0
commit
4c3ec5726c
3 files changed
+21
-6
No files matched your search
+5
-3
@@ -1,6 +1,6 @@
|
||||
import { S } from '../state.js';
|
||||
import { esc, toast } from '../utils.js';
|
||||
import { api, coverUrl, itunesSearch, itunesLookupAlbum, itunesLookupArtistSongs, itunesLookupArtistAlbums, fetchRomajiIndex, dispArtistById } from '../api.js';
|
||||
import { api, coverUrl, itunesSearch, itunesLookupAlbum, itunesLookupArtistSongs, itunesLookupArtistAlbums, fetchRomajiIndex, dispArtistById, cacheArtistSortNames } from '../api.js';
|
||||
import { makeCard, makeAlbumCard, makeGlobalTrackItem, makeSongItem } from '../ui/components.js';
|
||||
import { playQueue, dlSongLocal, toggleStar, parseArtists } from '../player/player.js';
|
||||
import { showCtxMenu, openDlModal } from '../ui/ui.js';
|
||||
@@ -99,7 +99,9 @@ export async function loadArtistDetail(artist) {
|
||||
// We reveal the hero with the album cover immediately, then patch in the artist photo async.
|
||||
const [albumRes] = await Promise.allSettled([albumP]);
|
||||
|
||||
const _firstAlbums = albumRes.status === 'fulfilled' ? (albumRes.value?.artist?.album || []) : [];
|
||||
const _ndArtist = albumRes.status === 'fulfilled' ? albumRes.value?.artist : null;
|
||||
if (_ndArtist) cacheArtistSortNames([_ndArtist]);
|
||||
const _firstAlbums = _ndArtist?.album || [];
|
||||
const _bgCover = _firstAlbums[0] ? coverUrl(_firstAlbums[0].coverArt, 512) : null;
|
||||
|
||||
const _revealHero = () => requestAnimationFrame(() => {
|
||||
@@ -171,7 +173,7 @@ export async function loadArtistDetail(artist) {
|
||||
}
|
||||
|
||||
// ── Top Songs ──
|
||||
const ndAlbums = albumRes.status === 'fulfilled' ? (albumRes.value?.artist?.album || []) : [];
|
||||
const ndAlbums = _ndArtist?.album || [];
|
||||
const topSongs = topRes.status === 'fulfilled' ? (topRes.value?.topSongs?.song || []) : [];
|
||||
const iTracks = iTracksRes.status === 'fulfilled' ? (iTracksRes.value || []).filter(t => t.wrapperType === 'track') : [];
|
||||
const iAlbums = iAlbumsRes.status === 'fulfilled' ? (iAlbumsRes.value || []) : [];
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
import { S } from '../state.js';
|
||||
import { esc } from '../utils.js';
|
||||
import { api, apiCached, apiIsCached, coverUrl, fetchRomajiIndex, dispArtistById } from '../api.js';
|
||||
import { api, apiCached, apiIsCached, coverUrl, fetchRomajiIndex, dispArtistById, cacheArtistSortNames } from '../api.js';
|
||||
import { makeCard, makeAlbumCard, makeSongItem } from '../ui/components.js';
|
||||
import { playQueue } from '../player/player.js';
|
||||
// Circular — safe (called inside event handlers)
|
||||
@@ -202,6 +202,7 @@ export async function loadArtists() {
|
||||
try {
|
||||
const r = await apiCached('getArtists');
|
||||
const all = (r.artists?.index || []).flatMap(i => i.artist || []);
|
||||
cacheArtistSortNames(all);
|
||||
if (S.cfg.showRomaji) await fetchRomajiIndex().catch(() => {});
|
||||
g.innerHTML = '';
|
||||
all.forEach(a => {
|
||||
|
||||
Reference in new issue
Block a user