From f97d19f12e93c729294fa675d30f2b6a9eebe9b9 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Tue, 18 Jan 2022 19:20:45 +0100 Subject: [PATCH] Fix changing state condition --- app/Utils/SongUtils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Utils/SongUtils.ts b/app/Utils/SongUtils.ts index 2a32d21..74f0fc3 100644 --- a/app/Utils/SongUtils.ts +++ b/app/Utils/SongUtils.ts @@ -6,6 +6,7 @@ import { Artist, InternalPlayerResponse, PlayerResponse, SpotifyToken } from 'Ap import Song from 'App/Models/Song' import queryString from 'query-string' import { updateGithubReadmeSpotify } from 'App/Utils/UpdateGithubReadme' +import { diff } from 'deep-object-diff' export async function getSpotifyAccount(): Promise { return await Redis.exists('spotify:account') @@ -126,7 +127,8 @@ export async function getCurrentPlayingFromSpotify(): Promise { } export async function updateCurrentSong(song: InternalPlayerResponse): Promise { - // const current = JSON.parse(await Redis.get('spotify/current') as string) + const current = JSON.parse(await Redis.get('spotify/current') as string) await Redis.set('spotify:current', JSON.stringify(song)) await updateGithubReadmeSpotify() - // const changed = diff(current, song) + const changed = diff(current, song) + console.log(changed) // todo send message to Rabbit }