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

Function fetchAlbumTracks

Extensions/shuffle+.js:342–356  ·  view source on GitHub ↗
(uri, includeMetadata = false)

Source from the content-addressed store, hash-verified

340 }
341
342 async function fetchAlbumTracks(uri, includeMetadata = false) {
343 const { queryAlbumTracks } = Spicetify.GraphQL.Definitions;
344 const { data, errors } = await Spicetify.GraphQL.Request(queryAlbumTracks, {
345 uri,
346 offset: 0,
347 limit: 100,
348 });
349
350 if (errors) throw errors[0].message;
351 if (data.albumUnion.playability.playable === false) throw "Album is not playable";
352
353 return (data.albumUnion?.tracksV2 ?? data.albumUnion?.tracks ?? []).items
354 .filter(({ track }) => track.playability.playable)
355 .map(({ track }) => (includeMetadata ? track : track.uri));
356 }
357
358 const artistFetchTypeCount = { album: 0, single: 0 };
359

Callers 2

scanForTracksFromAlbumsFunction · 0.85
fetchAndPlayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected