fix: inject iTunes previewUrl into Spotify importer track items
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
c8f82ceba5
commit
0c5fe53f13
1 file changed
+16
@@ -218,9 +218,25 @@ async function _loadSpotifyTrackArtwork(tracks, listEl) {
|
||||
if (match.releaseDate) t.releaseDate = match.releaseDate;
|
||||
if (match.trackNumber) t.trackNumber = match.trackNumber;
|
||||
if (match.trackExplicitness) t.trackExplicitness = match.trackExplicitness;
|
||||
if (match.previewUrl) t.previewUrl = match.previewUrl;
|
||||
if (window._spotifyResolved?.tracks?.[idx]) Object.assign(window._spotifyResolved.tracks[idx], t);
|
||||
const url = match.artworkUrl100 || match.artworkUrl60 || '';
|
||||
if (url) _setArt(artEls[idx], url);
|
||||
if (match.previewUrl) {
|
||||
const item = artEls[idx]?.closest('.gtrack-item');
|
||||
if (item && !item.querySelector('.gtrack-actions .icon-btn.blue')) {
|
||||
const actions = item.querySelector('.gtrack-actions');
|
||||
if (actions) {
|
||||
const btn = document.createElement('button');
|
||||
btn.className = 'icon-btn blue';
|
||||
btn.title = '30s Preview';
|
||||
btn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21 5 3"/></svg>';
|
||||
btn.onclick = (e) => { e.stopPropagation(); window.playPreview(t); };
|
||||
actions.insertBefore(btn, actions.firstChild);
|
||||
item.onclick = () => window.playPreview(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch { /* non-critical */ }
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user