MCPcopy
hub / github.com/spicetify/cli / scanForTracksFromAlbums

Function scanForTracksFromAlbums

Extensions/shuffle+.js:360–382  ·  view source on GitHub ↗
(res, artistName, type)

Source from the content-addressed store, hash-verified

358 const artistFetchTypeCount = { album: 0, single: 0 };
359
360 async function scanForTracksFromAlbums(res, artistName, type) {
361 const allTracks = [];
362
363 for (const album of res) {
364 let albumRes;
365
366 try {
367 albumRes = await fetchAlbumTracks(album.uri, true);
368 } catch (error) {
369 console.error(album, error);
370 continue;
371 }
372
373 artistFetchTypeCount[type]++;
374 Spicetify.showNotification(`${artistFetchTypeCount[type]} / ${res.length} ${type}s`);
375
376 for (const track of albumRes) {
377 if (!CONFIG.artistNameMust || track.artists.items.some((artist) => artist.profile.name === artistName)) allTracks.push(track.uri);
378 }
379 }
380
381 return allTracks;
382 }
383
384 async function fetchArtistTracks(uri) {
385 // Definitions from older Spotify version

Callers 1

fetchArtistTracksFunction · 0.85

Calls 1

fetchAlbumTracksFunction · 0.85

Tested by

no test coverage detected