fix: use iTunes names instead of kuromoji for Spotify Japanese tracks
Search iTunes with original Japanese names (accurate) rather than pre-converting with kuromoji (inaccurate for uncommon names/readings). iTunes returns the correct English artist name and title directly. Also run iTunes enrichment for single-track Spotify imports. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
446c583f7f
commit
36b09856ed
2 files changed
+2
-9
No files matched your search
@@ -225,13 +225,6 @@ app.post('/api/spotify/resolve', async (req, res) => {
|
|||||||
setTimeout(() => reject(new Error('Zeitüberschreitung — Spotify API antwortet nicht (>120s)')), 120000)
|
setTimeout(() => reject(new Error('Zeitüberschreitung — Spotify API antwortet nicht (>120s)')), 120000)
|
||||||
);
|
);
|
||||||
const data = await Promise.race([_resolveSpotifyViaSpotdl(url), timeout]);
|
const data = await Promise.race([_resolveSpotifyViaSpotdl(url), timeout]);
|
||||||
// Normalize Japanese artist/title names to romaji before sending to frontend
|
|
||||||
if (data.tracks) {
|
|
||||||
for (const t of data.tracks) {
|
|
||||||
if (t.artistName) t.artistName = romajiForStorage(t.artistName) || t.artistName;
|
|
||||||
if (t.trackName) t.trackName = romajiForStorage(t.trackName) || t.trackName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res.json(data);
|
res.json(data);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('[spotify/resolve]', e.message);
|
console.error('[spotify/resolve]', e.message);
|
||||||
|
|||||||
+2
-2
@@ -236,8 +236,8 @@ function _renderSpotifyPreview(data) {
|
|||||||
(data.tracks || []).forEach((t, i) => list.appendChild(makeGlobalTrackItem(t, i, data.tracks)));
|
(data.tracks || []).forEach((t, i) => list.appendChild(makeGlobalTrackItem(t, i, data.tracks)));
|
||||||
section.style.display = '';
|
section.style.display = '';
|
||||||
|
|
||||||
// Lazy-load correct per-track artwork via iTunes in the background
|
// Lazy-load correct per-track artwork and canonical names via iTunes in the background
|
||||||
if ((data.type === 'playlist' || data.type === 'album') && count > 0 && S.cfg.backendUrl) {
|
if (count > 0 && S.cfg.backendUrl) {
|
||||||
_loadSpotifyTrackArtwork(data.tracks, list);
|
_loadSpotifyTrackArtwork(data.tracks, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user