|
23 | 23 | throw ""; |
24 | 24 | } catch { |
25 | 25 | Spicetify.LocalStorage.set("shufflePlus:settings", "{}"); |
26 | | - return { artistMode: "all", artistNameMust: false, enableQueueButton: false }; |
| 26 | + return { |
| 27 | + artistMode: "all", |
| 28 | + artistNameMust: false, |
| 29 | + enableQueueButton: false, |
| 30 | + }; |
27 | 31 | } |
28 | 32 | } |
29 | 33 |
|
|
121 | 125 | onclickFun(); |
122 | 126 | }, |
123 | 127 | }, |
124 | | - React.createElement(DisplayIcon, { icon: Spicetify.SVGIcons.check, size: 16 }) |
| 128 | + React.createElement(DisplayIcon, { |
| 129 | + icon: Spicetify.SVGIcons.check, |
| 130 | + size: 16, |
| 131 | + }) |
125 | 132 | ) |
126 | 133 | ) |
127 | 134 | ); |
|
299 | 306 |
|
300 | 307 | function searchFolder(rows, uri) { |
301 | 308 | for (const r of rows) { |
302 | | - if (r.type !== "folder" || !r.rows) continue; |
| 309 | + if (r.type !== "folder" || !r.items) continue; |
303 | 310 |
|
304 | | - if (r.link === uri) return r; |
| 311 | + if (r.uri === uri) return r; |
305 | 312 |
|
306 | | - const found = searchFolder(r.rows, uri); |
| 313 | + const found = searchFolder(r.items, uri); |
307 | 314 | if (found) return found; |
308 | 315 | } |
309 | 316 | } |
310 | 317 |
|
311 | 318 | async function fetchFolderTracks(uri) { |
312 | | - const res = await Spicetify.CosmosAsync.get("sp://core-playlist/v1/rootlist", { |
313 | | - policy: { folder: { rows: true, link: true } }, |
314 | | - }); |
| 319 | + const res = await Spicetify.Platform.RootlistAPI.getContents(); |
315 | 320 |
|
316 | | - const requestFolder = searchFolder(res.rows, uri); |
| 321 | + const requestFolder = searchFolder(res.items, uri); |
317 | 322 | if (!requestFolder) throw "Cannot find folder"; |
318 | 323 |
|
319 | 324 | const requestPlaylists = []; |
320 | 325 | async function fetchNested(folder) { |
321 | | - if (!folder.rows) return; |
| 326 | + if (!folder.items) return; |
322 | 327 |
|
323 | | - for (const i of folder.rows) { |
| 328 | + for (const i of folder.items) { |
324 | 329 | if (i.type === "playlist") { |
325 | | - const uriObj = Spicetify.URI.fromString(i.link); |
| 330 | + const uriObj = Spicetify.URI.fromString(i.uri); |
326 | 331 | const uri = uriObj._base62Id ?? uriObj.id; |
327 | 332 | requestPlaylists.push(await fetchPlaylistTracks(uri)); |
328 | 333 | } else if (i.type === "folder") await fetchNested(i); |
|
336 | 341 |
|
337 | 342 | async function fetchAlbumTracks(uri, includeMetadata = false) { |
338 | 343 | const { queryAlbumTracks } = Spicetify.GraphQL.Definitions; |
339 | | - const { data, errors } = await Spicetify.GraphQL.Request(queryAlbumTracks, { uri, offset: 0, limit: 100 }); |
| 344 | + const { data, errors } = await Spicetify.GraphQL.Request(queryAlbumTracks, { |
| 345 | + uri, |
| 346 | + offset: 0, |
| 347 | + limit: 100, |
| 348 | + }); |
340 | 349 |
|
341 | 350 | if (errors) throw errors[0].message; |
342 | 351 | if (data.albumUnion.playability.playable === false) throw "Album is not playable"; |
|
540 | 549 |
|
541 | 550 | if (context) { |
542 | 551 | const { sessionId } = Spicetify.Platform.PlayerAPI.getState(); |
543 | | - Spicetify.Platform.PlayerAPI.updateContext(sessionId, { uri: context, url: `context://${context}` }); |
| 552 | + Spicetify.Platform.PlayerAPI.updateContext(sessionId, { |
| 553 | + uri: context, |
| 554 | + url: `context://${context}`, |
| 555 | + }); |
544 | 556 | } |
545 | 557 |
|
546 | 558 | Spicetify.Player.next(); |
|
0 commit comments