mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-08-05 12:26:41 +02:00
fixed the discord end time stamp issue. fixes #282
This commit is contained in:
@@ -30,30 +30,38 @@ const observer = () => {
|
||||
settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
|
||||
const buttonText =
|
||||
settingsStore.get<string, string>(settings.discord.buttonText) ?? "Play on TIDAL";
|
||||
const includeTimestamps =
|
||||
settingsStore.get<string, boolean>(settings.discord.includeTimestamps) ?? true;
|
||||
|
||||
let activity = {
|
||||
...idleStatus,
|
||||
...{
|
||||
startTimestamp: includeTimestamps ? now : undefined,
|
||||
endTimestamp: includeTimestamps ? remaining : undefined,
|
||||
},
|
||||
};
|
||||
if (mediaInfo.url) {
|
||||
rpc.setActivity({
|
||||
...idleStatus,
|
||||
activity = {
|
||||
...activity,
|
||||
...{
|
||||
details: `${detailsPrefix}${mediaInfo.title}`,
|
||||
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
|
||||
startTimestamp: now,
|
||||
endTimestamp: remaining,
|
||||
largeImageKey: mediaInfo.image,
|
||||
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
|
||||
buttons: [{ label: buttonText, url: mediaInfo.url }],
|
||||
},
|
||||
});
|
||||
};
|
||||
} else {
|
||||
rpc.setActivity({
|
||||
...idleStatus,
|
||||
activity = {
|
||||
...activity,
|
||||
...{
|
||||
details: `Watching ${mediaInfo.title}`,
|
||||
state: mediaInfo.artists,
|
||||
startTimestamp: now,
|
||||
endTimestamp: remaining,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
rpc.setActivity(activity);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -21,6 +21,7 @@ export const settingsStore = new Store({
|
||||
discord: {
|
||||
detailsPrefix: "Listening to ",
|
||||
buttonText: "Play on Tidal",
|
||||
includeTimestamps: true,
|
||||
},
|
||||
ListenBrainz: {
|
||||
enabled: false,
|
||||
@@ -61,6 +62,13 @@ export const settingsStore = new Store({
|
||||
migrationStore.get(settings.ListenBrainz.delay) ?? 5000
|
||||
);
|
||||
},
|
||||
"5.8.0": (migrationStore) => {
|
||||
console.log("running migrations for 5.8.0");
|
||||
migrationStore.set(
|
||||
settings.discord.includeTimestamps,
|
||||
migrationStore.get(settings.discord.includeTimestamps) ?? true
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user