Skip to content

Commit a82a4d7

Browse files
committed
Update Spicetify types + usage
For some reason, there seems to be a disconnect between the Queue type and the actual values, taking what works with Spotify client 1.2.26.1187
1 parent 3d2b9af commit a82a4d7

File tree

2 files changed

+2663
-1422
lines changed

2 files changed

+2663
-1422
lines changed

src/app.tsx

+8-12
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,17 @@ function generateButton(color: string, timecode: number | undefined): string {
6666

6767
function updateCurrentSong(allCues: SongCues): SongCue | undefined
6868
{
69-
const data = Spicetify.Player.data || Spicetify.Queue;
69+
const currentTrack = Spicetify.Player.data?.item || Spicetify.Queue.track?.contextTrack;
7070

71-
if (data) {
72-
const currentSong = data.track?.uri!
71+
if (currentTrack) {
72+
const currentCues = getOrCreateCue(allCues, currentTrack.uri);
73+
const nbCuesForSong = countCues(currentCues.cues);
7374

74-
if (currentSong) {
75-
const currentCues = getOrCreateCue(allCues, currentSong);
76-
const nbCuesForSong = countCues(currentCues.cues);
77-
78-
if (nbCuesForSong > 0) {
79-
Spicetify.showNotification("ℹ️ Found " + nbCuesForSong + " clues for this track");
80-
}
81-
82-
return currentCues;
75+
if (nbCuesForSong > 0) {
76+
Spicetify.showNotification("ℹ️ Found " + nbCuesForSong + " clues for this track");
8377
}
78+
79+
return currentCues;
8480
}
8581

8682
return undefined;

0 commit comments

Comments
 (0)