mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 13:32:42 +01:00
Release 2.4.0 (#74)
Update MPRIS functionality to provide length, artist, and current position. Also added rescrobbler explanation to the README. Co-authored-by: Vinay V <cool00geek@yahoo.com>
This commit is contained in:
parent
8fea5265e7
commit
5ef6074015
@ -20,6 +20,7 @@ The web version of [listen.tidal.com](https://listen.tidal.com) running in elect
|
||||
- [Integrations](#integrations)
|
||||
- [not included](#not-included)
|
||||
- [Known bugs](#known-bugs)
|
||||
- [last.fm doesn't work out of the box. Use rescrobbler as a workaround](#lastfm-doesnt-work-out-of-the-box-use-rescrobbler-as-a-workaround)
|
||||
- [Why](#why)
|
||||
- [Why not extend existing projects?](#why-not-extend-existing-projects)
|
||||
- [Special thanks to...](#special-thanks-to)
|
||||
@ -96,7 +97,11 @@ It currently includes:
|
||||
|
||||
### Known bugs
|
||||
|
||||
- [Last.fm login doesn't work](https://github.com/Mastermindzh/tidal-hifi/issues/4).
|
||||
#### last.fm doesn't work out of the box. Use rescrobbler as a workaround
|
||||
|
||||
The last.fm login doesn't work, as is evident from the following issue: [Last.fm login doesn't work](https://github.com/Mastermindzh/tidal-hifi/issues/4).
|
||||
However, in that same issue you can read about a workaround using [rescrobbler](https://github.com/InputUsername/rescrobbled).
|
||||
For now that will be the default workaround.
|
||||
|
||||
## Why
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tidal-hifi",
|
||||
"version": "2.3.0",
|
||||
"version": "2.4.0",
|
||||
"description": "Tidal on Electron with widevine(hifi) support",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -234,6 +234,15 @@ function getCurrentlyPlayingStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the duration from MM:SS to seconds
|
||||
* @param {*} duration
|
||||
*/
|
||||
function convertDuration(duration) {
|
||||
const parts = duration.split(":");
|
||||
return parseInt(parts[1]) + 60 * parseInt(parts[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Tidal-hifi's media info
|
||||
*
|
||||
@ -243,14 +252,14 @@ function updateMediaInfo(options, notify) {
|
||||
if (options) {
|
||||
ipcRenderer.send(globalEvents.updateInfo, options);
|
||||
store.get(settings.notifications) && notify && notifier.notify(options);
|
||||
|
||||
if (player) {
|
||||
player.metadata = {
|
||||
...player.metadata,
|
||||
...{
|
||||
"xesam:title": options.title,
|
||||
"xesam:artist": [options.artists],
|
||||
"xesam:artist": [options.message],
|
||||
"mpris:artUrl": options.image,
|
||||
"mpris:length": convertDuration(options.duration) * 1000 * 1000,
|
||||
},
|
||||
};
|
||||
player.playbackStatus = options.status == statuses.paused ? "Paused" : "Playing";
|
||||
@ -331,6 +340,7 @@ setInterval(function () {
|
||||
|
||||
new Promise((resolve) => {
|
||||
if (image.startsWith("http")) {
|
||||
options.image = image;
|
||||
downloadFile(image, notificationPath).then(
|
||||
() => {
|
||||
options.icon = notificationPath;
|
||||
@ -397,6 +407,10 @@ if (process.platform === "linux" && store.get(settings.mpris)) {
|
||||
}
|
||||
});
|
||||
});
|
||||
// Override get position function
|
||||
player.getPosition = function () {
|
||||
return convertDuration(elements.getText("current")) * 1000 * 1000;
|
||||
};
|
||||
|
||||
player.on("quit", function () {
|
||||
app.quit();
|
||||
|
Loading…
Reference in New Issue
Block a user