(uri)
| 316 | } |
| 317 | |
| 318 | async function fetchFolderTracks(uri) { |
| 319 | const res = await Spicetify.Platform.RootlistAPI.getContents(); |
| 320 | |
| 321 | const requestFolder = searchFolder(res.items, uri); |
| 322 | if (!requestFolder) throw "Cannot find folder"; |
| 323 | |
| 324 | const requestPlaylists = []; |
| 325 | async function fetchNested(folder) { |
| 326 | if (!folder.items) return; |
| 327 | |
| 328 | for (const i of folder.items) { |
| 329 | if (i.type === "playlist") { |
| 330 | const uriObj = Spicetify.URI.fromString(i.uri); |
| 331 | const uri = uriObj._base62Id ?? uriObj.id; |
| 332 | requestPlaylists.push(await fetchPlaylistTracks(uri)); |
| 333 | } else if (i.type === "folder") await fetchNested(i); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | await fetchNested(requestFolder); |
| 338 | |
| 339 | return requestPlaylists.flat(); |
| 340 | } |
| 341 | |
| 342 | async function fetchAlbumTracks(uri, includeMetadata = false) { |
| 343 | const { queryAlbumTracks } = Spicetify.GraphQL.Definitions; |
no test coverage detected