ooprs
This commit is contained in:
parent
20e08186d7
commit
7a9f3a4b2a
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue