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

Function toggleThrow

Extensions/trashbin.js:311–330  ·  view source on GitHub ↗

* * @param {string[]} uris

(uris)

Source from the content-addressed store, hash-verified

309 * @param {string[]} uris
310 */
311 function toggleThrow(uris) {
312 const uri = uris[0];
313 const uriObj = Spicetify.URI.fromString(uri);
314 const type = uriObj.type;
315
316 const list = type === Spicetify.URI.Type.TRACK ? trashSongList : trashArtistList;
317
318 if (!list[uri]) {
319 list[uri] = true;
320 if (shouldSkipCurrentTrack(uri, type)) Spicetify.Player.next();
321 Spicetify.Player.data?.item.uri === uri && setWidgetState(true);
322 Spicetify.showNotification(type === Spicetify.URI.Type.TRACK ? "Song added to trashbin" : "Artist added to trashbin");
323 } else {
324 delete list[uri];
325 Spicetify.Player.data?.item.uri === uri && setWidgetState(false);
326 Spicetify.showNotification(type === Spicetify.URI.Type.TRACK ? "Song removed from trashbin" : "Artist removed from trashbin");
327 }
328
329 putDataLocal();
330 }
331
332 /**
333 * Only accept one track or artist URI

Callers

nothing calls this directly

Calls 3

shouldSkipCurrentTrackFunction · 0.85
setWidgetStateFunction · 0.85
putDataLocalFunction · 0.85

Tested by

no test coverage detected