Skip to content

Commit

Permalink
Enable Activity Type in RPC (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdasda7777 authored Jan 1, 2025
1 parent 143aaf4 commit e7aa0ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/rpc/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
});
Expand Down
19 changes: 8 additions & 11 deletions src/rpc/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,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
Expand All @@ -216,10 +217,9 @@ module.exports = async (status) => {
: undefined)
};

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;
}
Expand All @@ -237,14 +237,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;

Expand Down

0 comments on commit e7aa0ff

Please sign in to comment.