Skip to content

Commit

Permalink
fix(stats): return correctly parsed spotify song
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Oct 27, 2023
1 parent 55fbe25 commit c5225f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class Stats extends Core {
}

const ytCurrentSong = Object.values(songs.isPlaying).find(o => o) ? get(JSON.parse(songs.currentSong), 'title', null) : null;
let spotifyCurrentSong: null | string = get(JSON.parse(spotify.currentSong), 'song', '') + ' - ' + get(JSON.parse(spotify.currentSong), 'artist', '');
if (spotifyCurrentSong.trim().length === 1 /* '-' */ || get(JSON.parse(spotify.currentSong), 'is_playing', false)) {
spotifyCurrentSong = null;
const spotifySongParsed = JSON.parse(spotify.currentSong);
let spotifyCurrentSong: null | string = null;
if (spotifySongParsed && spotifySongParsed.is_playing) {
spotifyCurrentSong = `${spotifySongParsed.song} - ${spotifySongParsed.artist}`;
}

const broadcasterType = variables.get('services.twitch.broadcasterType') as string;
Expand Down

0 comments on commit c5225f9

Please sign in to comment.