mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-07-28 00:22:26 +02:00
re-enabled mpris after the 403 has been fixed
This commit is contained in:
@@ -18,7 +18,7 @@ function refreshSettings() {
|
||||
port.value = store.get(settings.apiSettings.port);
|
||||
menuBar.checked = store.get(settings.menuBar);
|
||||
trayIcon.checked = store.get(settings.trayIcon);
|
||||
// mpris.checked = store.get(settings.mpris);
|
||||
mpris.checked = store.get(settings.mpris);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
port = get("port");
|
||||
menuBar = get("menuBar");
|
||||
trayIcon = get("trayIcon");
|
||||
// mpris = get("mprisCheckbox");
|
||||
mpris = get("mprisCheckbox");
|
||||
|
||||
refreshSettings();
|
||||
|
||||
@@ -88,5 +88,5 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
addInputListener(port, settings.apiSettings.port);
|
||||
addInputListener(menuBar, settings.menuBar);
|
||||
addInputListener(trayIcon, settings.trayIcon);
|
||||
// addInputListener(mpris, settings.mpris);
|
||||
addInputListener(mpris, settings.mpris);
|
||||
});
|
||||
|
@@ -121,8 +121,7 @@
|
||||
<p style="margin-bottom: 15px;">
|
||||
Tidal-hifi is extensible trough the use of integrations. You can enable or disable integrations here
|
||||
</p>
|
||||
<!-- disabled until the 403 with mpris-service/dbus is fixed -->
|
||||
<!-- <div class="option">
|
||||
<div class="option">
|
||||
<h4>mpris-player</h4>
|
||||
<p>
|
||||
Whether to enable the mpris media player controls for Linux systems
|
||||
@@ -131,7 +130,7 @@
|
||||
<input id="mprisCheckbox" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="about" class="tab-panel">
|
||||
|
124
src/preload.js
124
src/preload.js
@@ -10,7 +10,7 @@ const globalEvents = require("./constants/globalEvents");
|
||||
const notifier = require("node-notifier");
|
||||
const notificationPath = `${app.getPath("userData")}/notification.jpg`;
|
||||
let currentSong = "";
|
||||
// let player;
|
||||
let player;
|
||||
|
||||
const elements = {
|
||||
play: '*[data-test="play"]',
|
||||
@@ -229,9 +229,9 @@ function updateStatus() {
|
||||
|
||||
if (status) {
|
||||
ipcRenderer.send(globalEvents.updateStatus, status);
|
||||
// if (player) {
|
||||
// player.playbackStatus = status == statuses.paused ? "Paused" : "Playing";
|
||||
// }
|
||||
if (player) {
|
||||
player.playbackStatus = status == statuses.paused ? "Paused" : "Playing";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,16 +275,16 @@ setInterval(function () {
|
||||
ipcRenderer.send(globalEvents.updateInfo, options);
|
||||
store.get(settings.notifications) && notifier.notify(options);
|
||||
|
||||
// if (player) {
|
||||
// player.metadata = {
|
||||
// ...player.metadata,
|
||||
// ...{
|
||||
// "xesam:title": title,
|
||||
// "xesam:artist": [artists],
|
||||
// "mpris:artUrl": image,
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
if (player) {
|
||||
player.metadata = {
|
||||
...player.metadata,
|
||||
...{
|
||||
"xesam:title": title,
|
||||
"xesam:artist": [artists],
|
||||
"mpris:artUrl": image,
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
() => {}
|
||||
);
|
||||
@@ -292,57 +292,57 @@ setInterval(function () {
|
||||
}
|
||||
}, 200);
|
||||
|
||||
// if (process.platform === "linux" && store.get(settings.mpris)) {
|
||||
// try {
|
||||
// const Player = require("mpris-service");
|
||||
// player = Player({
|
||||
// name: "tidal-hifi",
|
||||
// identity: "tidal-hifi",
|
||||
// supportedUriSchemes: ["file"],
|
||||
// supportedMimeTypes: [
|
||||
// "audio/mpeg",
|
||||
// "audio/flac",
|
||||
// "audio/x-flac",
|
||||
// "application/ogg",
|
||||
// "audio/wav",
|
||||
// ],
|
||||
// supportedInterfaces: ["player"],
|
||||
// desktopEntry: "tidal-hifi",
|
||||
// });
|
||||
if (process.platform === "linux" && store.get(settings.mpris)) {
|
||||
try {
|
||||
const Player = require("mpris-service");
|
||||
player = Player({
|
||||
name: "tidal-hifi",
|
||||
identity: "tidal-hifi",
|
||||
supportedUriSchemes: ["file"],
|
||||
supportedMimeTypes: [
|
||||
"audio/mpeg",
|
||||
"audio/flac",
|
||||
"audio/x-flac",
|
||||
"application/ogg",
|
||||
"audio/wav",
|
||||
],
|
||||
supportedInterfaces: ["player"],
|
||||
desktopEntry: "tidal-hifi",
|
||||
});
|
||||
|
||||
// // Events
|
||||
// var events = {
|
||||
// next: "next",
|
||||
// previous: "previous",
|
||||
// pause: "pause",
|
||||
// playpause: "playpause",
|
||||
// stop: "stop",
|
||||
// play: "play",
|
||||
// loopStatus: "repeat",
|
||||
// shuffle: "shuffle",
|
||||
// seek: "seek",
|
||||
// };
|
||||
// Object.keys(events).forEach(function (eventName) {
|
||||
// player.on(eventName, function () {
|
||||
// const eventValue = events[eventName];
|
||||
// switch (events[eventValue]) {
|
||||
// case events.playpause:
|
||||
// playPause();
|
||||
// break;
|
||||
// Events
|
||||
var events = {
|
||||
next: "next",
|
||||
previous: "previous",
|
||||
pause: "pause",
|
||||
playpause: "playpause",
|
||||
stop: "stop",
|
||||
play: "play",
|
||||
loopStatus: "repeat",
|
||||
shuffle: "shuffle",
|
||||
seek: "seek",
|
||||
};
|
||||
Object.keys(events).forEach(function (eventName) {
|
||||
player.on(eventName, function () {
|
||||
const eventValue = events[eventName];
|
||||
switch (events[eventValue]) {
|
||||
case events.playpause:
|
||||
playPause();
|
||||
break;
|
||||
|
||||
// default:
|
||||
// elements.click(eventValue);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
default:
|
||||
elements.click(eventValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// player.on("quit", function () {
|
||||
// app.quit();
|
||||
// });
|
||||
// } catch (exception) {
|
||||
// console.log("player api not working");
|
||||
// }
|
||||
// }
|
||||
player.on("quit", function () {
|
||||
app.quit();
|
||||
});
|
||||
} catch (exception) {
|
||||
console.log("player api not working");
|
||||
}
|
||||
}
|
||||
|
||||
addHotKeys();
|
||||
addIPCEventListeners();
|
||||
|
Reference in New Issue
Block a user