From 7a9f3a4b2ac2909f7f15e4a31a26b4c264923fe6 Mon Sep 17 00:00:00 2001 From: Lea Date: Sun, 19 May 2024 17:51:40 +0200 Subject: [PATCH] ooprs --- src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index ee19213..eb53634 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ let rpcClient = new RPC.Client({ transport: "ipc" }); rpcClient.login({ clientId: CLIENT_ID, scopes: [] }) type PlaybackData = { + isDeezer?: boolean, artUrl?: string, album?: string, artist?: string[], @@ -58,10 +59,11 @@ async function run() { switch(prop) { case 'Metadata': { if (!data?.["xesam:url"]?.value?.startsWith("https://www.deezer.com/")) { - data = { playing: false }; + playbackData = { playing: false, isDeezer: false }; return; } + playbackData.isDeezer = true; playbackData.artUrl = data?.["mpris:artUrl"]?.value; playbackData.length = Number(data?.["mpris:length"]?.value) / 1000; playbackData.album = data?.["xesam:album"]?.value; @@ -98,7 +100,7 @@ async function run() { } console.log("Setting presence"); - if (!playbackData.playing && !playbackData.paused) { + if ((!playbackData.playing && !playbackData.paused) || !playbackData.isDeezer) { await rpcClient.clearActivity(); } else {