From a929c5c2884883a00d9048e4150a15d0ddec587b Mon Sep 17 00:00:00 2001 From: sdasda7777 <17746796+sdasda7777@users.noreply.github.com> Date: Wed, 1 Jan 2025 18:03:44 +0100 Subject: [PATCH] Enable Activity Type in RPC --- src/rpc/client.js | 12 ++++++------ src/rpc/format.js | 19 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/rpc/client.js b/src/rpc/client.js index 2e6e2bd..000bffb 100755 --- a/src/rpc/client.js +++ b/src/rpc/client.js @@ -45,12 +45,12 @@ function update() { awake = false; client.clearActivity(); } else { - if (config.console.presencestate == true){ - console.log("Presence updated") - } - client.setActivity(await format(status)); - awake = false; - } + if (config.console.presencestate == true){ + console.log("Presence updated") + } + client.setActivity(await format(status)); + awake = false; + } } } }); diff --git a/src/rpc/format.js b/src/rpc/format.js index 9c429bb..63d70fb 100755 --- a/src/rpc/format.js +++ b/src/rpc/format.js @@ -300,6 +300,7 @@ module.exports = async (status) => { ); let output = { + type: 0, // Shows file thats playing.. well most of the time details: meta.title || meta.filename || "Playing something..", // Sets album art depending on whats set in the file, or if album art cannot be found @@ -320,10 +321,9 @@ module.exports = async (status) => { ]; } - if(status.stats.decodedvideo > 0) - { // if video - if (meta['YouTube Start Time'] !== undefined) - { // if youtube video + if(status.stats.decodedvideo > 0) { // if video + output.type = 3; + if (meta['YouTube Start Time'] !== undefined) { // if youtube video output.largeImageKey = 'youtube'; output.largeImageText = meta.url; } @@ -341,14 +341,11 @@ module.exports = async (status) => { } else { output.state = `${(status.date || '')} Video`; } - } - else if (meta.now_playing) - { // if a stream + } else if (meta.now_playing) { // if a stream + output.type = 1; output.state = meta.now_playing || "Stream"; - } - else if (display_artist) - { // if a song - + } else if (display_artist) { // if a song + output.type = 2; // Add artist to the state output.state = display_artist;