fix: iTunes artist match and MusicBrainz first-artist-only query
iTunes: split artist by [\s,;/] not just space so "VXLLAIN, iGRES" yields first word "vxllain" (no trailing comma) and matches correctly. MusicBrainz: extract first artist from the full credit string (split on ,;&•) and use `artistname` field — MB stores credits like "VXLLAIN feat. iGRES & ENXK" which never matched the comma-joined full string. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae48ed4129
commit
17414ca888
2 files changed
+8
-4
No files matched your search
@@ -95,11 +95,13 @@ async function lookupItunesTrackMeta(artist, title) {
|
||||
res.on('end', () => { try { resolve(JSON.parse(d).results || []); } catch { reject(new Error('parse')); } });
|
||||
}).on('error', reject);
|
||||
});
|
||||
const normT = normalizeTitle(title);
|
||||
const normA = (artist || '').toLowerCase().trim();
|
||||
const normT = normalizeTitle(title);
|
||||
const normA = (artist || '').toLowerCase().trim();
|
||||
// Split by space OR comma/semicolon/slash so "VXLLAIN, iGRES" → "vxllain" not "vxllain,"
|
||||
const firstWord = s => (s || '').toLowerCase().split(/[\s,;/]/)[0];
|
||||
const match = results.find(t =>
|
||||
normalizeTitle(t.trackName) === normT &&
|
||||
(t.artistName || '').toLowerCase().trim().split(' ')[0] === normA.split(' ')[0]
|
||||
firstWord(t.artistName) === firstWord(normA)
|
||||
);
|
||||
if (!match) return {};
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user