Merge pull request #587 from xn-oah/master

Add album title to largeImage and change paused icon
This commit is contained in:
th-ch
2022-02-13 19:07:43 +01:00
committed by GitHub

View File

@ -4,8 +4,8 @@ const { dialog, app } = require("electron");
const registerCallback = require("../../providers/song-info"); const registerCallback = require("../../providers/song-info");
// Application ID registered by @semvis123 // Application ID registered by @xn-oah
const clientId = "790655993809338398"; const clientId = "937234785716285471";
/** /**
* @typedef {Object} Info * @typedef {Object} Info
@ -104,19 +104,16 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime, listenAlong
details: songInfo.title, details: songInfo.title,
state: songInfo.artist, state: songInfo.artist,
largeImageKey: songInfo.imageSrc, largeImageKey: songInfo.imageSrc,
largeImageText: [ largeImageText: songInfo.album,
songInfo.uploadDate, buttons: listenAlong ? [
songInfo.views.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " views",
].join(' || '),
buttons: listenAlong ? [
{ label: "Listen Along", url: songInfo.url }, { label: "Listen Along", url: songInfo.url },
] : undefined, ] : undefined,
}; };
if (songInfo.isPaused) { if (songInfo.isPaused) {
// Add an idle icon to show that the song is paused // Add a paused icon to show that the song is paused
activityInfo.smallImageKey = "idle"; activityInfo.smallImageKey = "paused";
activityInfo.smallImageText = "idle/paused"; activityInfo.smallImageText = "Paused";
// Set start the timer so the activity gets cleared after a while if enabled // Set start the timer so the activity gets cleared after a while if enabled
if (activityTimoutEnabled) if (activityTimoutEnabled)
clearActivity = setTimeout(() => info.rpc.clearActivity().catch(console.error), activityTimoutTime ?? 10000); clearActivity = setTimeout(() => info.rpc.clearActivity().catch(console.error), activityTimoutTime ?? 10000);