mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-21 21:13:00 +01:00
fixed the discord end time stamp issue. fixes #282
This commit is contained in:
parent
5e82c18d8a
commit
5240f1eeeb
@ -6,15 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [5.8.0]
|
## [5.8.0]
|
||||||
|
|
||||||
- Updated Electron to 28.1.1 for issue [325](https://github.com/Mastermindzh/tidal-hifi/issues/325)
|
- Updated Electron to 28.1.1 (fixes [325](https://github.com/Mastermindzh/tidal-hifi/issues/325))
|
||||||
- Updated dependencies to latest
|
- Updated dependencies to latest
|
||||||
- added theme files to stylelint ignore
|
- added theme files to stylelint ignore
|
||||||
- fixed other stylelint errors
|
- fixed other stylelint errors
|
||||||
- Added functionality to favorite a song ([fixes #323](https://github.com/Mastermindzh/tidal-hifi/issues/323))
|
|
||||||
|
- Added functionality to favorite a song (fixes [#323](https://github.com/Mastermindzh/tidal-hifi/issues/323))
|
||||||
- Added a hotkey to favorite ("Add to collection") songs: Control+a
|
- Added a hotkey to favorite ("Add to collection") songs: Control+a
|
||||||
- Added the "favorite" field in the `mediaInfo` and the API `/current` endpoint
|
- Added the "favorite" field in the `mediaInfo` and the API `/current` endpoint
|
||||||
- Added an endpoint to toggle favoriting a song: `http://localhost:47836/favorite/toggle`
|
- Added an endpoint to toggle favoriting a song: `http://localhost:47836/favorite/toggle`
|
||||||
|
|
||||||
|
- Fixed wrong "end time stamp" for currently playing song (fixes [#282](https://github.com/Mastermindzh/tidal-hifi/issues/282))
|
||||||
|
- Affected the API + all integrations
|
||||||
|
- As requested we also added toggle to sync the timestamps to Discord (default = true)
|
||||||
|
|
||||||
## [5.7.1]
|
## [5.7.1]
|
||||||
|
|
||||||
- Fixed mpris not being set up correctly due to capitalization of the instance name.
|
- Fixed mpris not being set up correctly due to capitalization of the instance name.
|
||||||
|
@ -16,11 +16,12 @@
|
|||||||
search: '[class^="searchField"]',
|
search: '[class^="searchField"]',
|
||||||
shuffle: '*[data-test="shuffle"]',
|
shuffle: '*[data-test="shuffle"]',
|
||||||
repeat: '*[data-test="repeat"]',
|
repeat: '*[data-test="repeat"]',
|
||||||
account: '*[data-test^="profile-image-button"]',
|
account: '*[class^="profileOptions"]',
|
||||||
|
settings: '*[data-test^="open-settings"]',
|
||||||
media: '*[data-test="current-media-imagery"]',
|
media: '*[data-test="current-media-imagery"]',
|
||||||
image: "img",
|
image: "img",
|
||||||
current: '*[data-test="current-time"]',
|
current: '*[data-test="current-time"]',
|
||||||
duration: '*[data-test="duration"]',
|
duration: '*[class^=playbackControlsContainer] *[data-test="duration"]',
|
||||||
bar: '*[data-test="progress-bar"]',
|
bar: '*[data-test="progress-bar"]',
|
||||||
footer: "#footerPlayer",
|
footer: "#footerPlayer",
|
||||||
mediaItem: "[data-type='mediaItem']",
|
mediaItem: "[data-type='mediaItem']",
|
||||||
@ -29,6 +30,7 @@
|
|||||||
album_name_cell: '[class^="album"]',
|
album_name_cell: '[class^="album"]',
|
||||||
tracklist_row: '[data-test="tracklist-row"]',
|
tracklist_row: '[data-test="tracklist-row"]',
|
||||||
volume: '*[data-test="volume"]',
|
volume: '*[data-test="volume"]',
|
||||||
|
favorite: '*[data-test="footer-favorite-button"]',
|
||||||
};
|
};
|
||||||
|
|
||||||
let results = [];
|
let results = [];
|
||||||
|
@ -23,6 +23,7 @@ export const settings = {
|
|||||||
discord: {
|
discord: {
|
||||||
detailsPrefix: "discord.detailsPrefix",
|
detailsPrefix: "discord.detailsPrefix",
|
||||||
buttonText: "discord.buttonText",
|
buttonText: "discord.buttonText",
|
||||||
|
includeTimestamps: "discord.includeTimestamps",
|
||||||
},
|
},
|
||||||
ListenBrainz: {
|
ListenBrainz: {
|
||||||
root: "ListenBrainz",
|
root: "ListenBrainz",
|
||||||
|
@ -48,6 +48,7 @@ let adBlock: HTMLInputElement,
|
|||||||
listenbrainz_delay: HTMLInputElement,
|
listenbrainz_delay: HTMLInputElement,
|
||||||
enableWaylandSupport: HTMLInputElement,
|
enableWaylandSupport: HTMLInputElement,
|
||||||
discord_details_prefix: HTMLInputElement,
|
discord_details_prefix: HTMLInputElement,
|
||||||
|
discord_include_timestamps: HTMLInputElement,
|
||||||
discord_button_text: HTMLInputElement;
|
discord_button_text: HTMLInputElement;
|
||||||
|
|
||||||
addCustomCss(app);
|
addCustomCss(app);
|
||||||
@ -135,6 +136,7 @@ function refreshSettings() {
|
|||||||
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
||||||
listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay);
|
listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay);
|
||||||
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix);
|
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix);
|
||||||
|
discord_include_timestamps.checked = settingsStore.get(settings.discord.includeTimestamps);
|
||||||
discord_button_text.value = settingsStore.get(settings.discord.buttonText);
|
discord_button_text.value = settingsStore.get(settings.discord.buttonText);
|
||||||
|
|
||||||
// set state of all switches with additional settings
|
// set state of all switches with additional settings
|
||||||
@ -246,6 +248,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
ListenBrainzAPI = get("ListenBrainzAPI");
|
ListenBrainzAPI = get("ListenBrainzAPI");
|
||||||
ListenBrainzToken = get("ListenBrainzToken");
|
ListenBrainzToken = get("ListenBrainzToken");
|
||||||
discord_details_prefix = get("discord_details_prefix");
|
discord_details_prefix = get("discord_details_prefix");
|
||||||
|
discord_include_timestamps = get("discord_include_timestamps");
|
||||||
listenbrainz_delay = get("listenbrainz_delay");
|
listenbrainz_delay = get("listenbrainz_delay");
|
||||||
discord_button_text = get("discord_button_text");
|
discord_button_text = get("discord_button_text");
|
||||||
|
|
||||||
@ -280,5 +283,6 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
addInputListener(ListenBrainzToken, settings.ListenBrainz.token);
|
addInputListener(ListenBrainzToken, settings.ListenBrainz.token);
|
||||||
addInputListener(listenbrainz_delay, settings.ListenBrainz.delay);
|
addInputListener(listenbrainz_delay, settings.ListenBrainz.delay);
|
||||||
addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
|
addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
|
||||||
|
addInputListener(discord_include_timestamps, settings.discord.includeTimestamps);
|
||||||
addInputListener(discord_button_text, settings.discord.buttonText);
|
addInputListener(discord_button_text, settings.discord.buttonText);
|
||||||
});
|
});
|
||||||
|
@ -216,6 +216,17 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="discord_options">
|
<div id="discord_options">
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Include timestamps</h4>
|
||||||
|
<p>Show current/end playtime in the Discord client</p>
|
||||||
|
</div>
|
||||||
|
<label class="switch">
|
||||||
|
<input id="discord_include_timestamps" type="checkbox" />
|
||||||
|
<span class="switch__slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="group__option" class="hidden">
|
<div class="group__option" class="hidden">
|
||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Details prefix</h4>
|
<h4>Details prefix</h4>
|
||||||
|
@ -45,7 +45,7 @@ const elements = {
|
|||||||
media: '*[data-test="current-media-imagery"]',
|
media: '*[data-test="current-media-imagery"]',
|
||||||
image: "img",
|
image: "img",
|
||||||
current: '*[data-test="current-time"]',
|
current: '*[data-test="current-time"]',
|
||||||
duration: '*[data-test="duration"]',
|
duration: '*[class^=playbackControlsContainer] *[data-test="duration"]',
|
||||||
bar: '*[data-test="progress-bar"]',
|
bar: '*[data-test="progress-bar"]',
|
||||||
footer: "#footerPlayer",
|
footer: "#footerPlayer",
|
||||||
mediaItem: "[data-type='mediaItem']",
|
mediaItem: "[data-type='mediaItem']",
|
||||||
|
@ -30,30 +30,38 @@ const observer = () => {
|
|||||||
settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
|
settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
|
||||||
const buttonText =
|
const buttonText =
|
||||||
settingsStore.get<string, string>(settings.discord.buttonText) ?? "Play on TIDAL";
|
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) {
|
if (mediaInfo.url) {
|
||||||
rpc.setActivity({
|
activity = {
|
||||||
...idleStatus,
|
...activity,
|
||||||
...{
|
...{
|
||||||
details: `${detailsPrefix}${mediaInfo.title}`,
|
details: `${detailsPrefix}${mediaInfo.title}`,
|
||||||
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
|
state: mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)",
|
||||||
startTimestamp: now,
|
|
||||||
endTimestamp: remaining,
|
|
||||||
largeImageKey: mediaInfo.image,
|
largeImageKey: mediaInfo.image,
|
||||||
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
|
largeImageText: mediaInfo.album ? mediaInfo.album : `${idleStatus.largeImageText}`,
|
||||||
buttons: [{ label: buttonText, url: mediaInfo.url }],
|
buttons: [{ label: buttonText, url: mediaInfo.url }],
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
} else {
|
} else {
|
||||||
rpc.setActivity({
|
activity = {
|
||||||
...idleStatus,
|
...activity,
|
||||||
...{
|
...{
|
||||||
details: `Watching ${mediaInfo.title}`,
|
details: `Watching ${mediaInfo.title}`,
|
||||||
state: mediaInfo.artists,
|
state: mediaInfo.artists,
|
||||||
startTimestamp: now,
|
|
||||||
endTimestamp: remaining,
|
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpc.setActivity(activity);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ export const settingsStore = new Store({
|
|||||||
discord: {
|
discord: {
|
||||||
detailsPrefix: "Listening to ",
|
detailsPrefix: "Listening to ",
|
||||||
buttonText: "Play on Tidal",
|
buttonText: "Play on Tidal",
|
||||||
|
includeTimestamps: true,
|
||||||
},
|
},
|
||||||
ListenBrainz: {
|
ListenBrainz: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@ -61,6 +62,13 @@ export const settingsStore = new Store({
|
|||||||
migrationStore.get(settings.ListenBrainz.delay) ?? 5000
|
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
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user