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: [] })
|
rpcClient.login({ clientId: CLIENT_ID, scopes: [] })
|
||||||
|
|
||||||
type PlaybackData = {
|
type PlaybackData = {
|
||||||
|
isDeezer?: boolean,
|
||||||
artUrl?: string,
|
artUrl?: string,
|
||||||
album?: string,
|
album?: string,
|
||||||
artist?: string[],
|
artist?: string[],
|
||||||
|
@ -58,10 +59,11 @@ async function run() {
|
||||||
switch(prop) {
|
switch(prop) {
|
||||||
case 'Metadata': {
|
case 'Metadata': {
|
||||||
if (!data?.["xesam:url"]?.value?.startsWith("https://www.deezer.com/")) {
|
if (!data?.["xesam:url"]?.value?.startsWith("https://www.deezer.com/")) {
|
||||||
data = { playing: false };
|
playbackData = { playing: false, isDeezer: false };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playbackData.isDeezer = true;
|
||||||
playbackData.artUrl = data?.["mpris:artUrl"]?.value;
|
playbackData.artUrl = data?.["mpris:artUrl"]?.value;
|
||||||
playbackData.length = Number(data?.["mpris:length"]?.value) / 1000;
|
playbackData.length = Number(data?.["mpris:length"]?.value) / 1000;
|
||||||
playbackData.album = data?.["xesam:album"]?.value;
|
playbackData.album = data?.["xesam:album"]?.value;
|
||||||
|
@ -98,7 +100,7 @@ async function run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Setting presence");
|
console.log("Setting presence");
|
||||||
if (!playbackData.playing && !playbackData.paused) {
|
if ((!playbackData.playing && !playbackData.paused) || !playbackData.isDeezer) {
|
||||||
await rpcClient.clearActivity();
|
await rpcClient.clearActivity();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue