This commit is contained in:
Rick van Lieshout 2020-10-04 11:52:08 +02:00 committed by GitHub
parent e13af7a2d5
commit beacedd64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 594 additions and 663 deletions

View File

@ -32,7 +32,7 @@ jobs:
- uses: actions/upload-artifact@master
with:
name: mac-builds
path: dist/
path: ./dist/
build_on_win:
runs-on: windows-latest

14
CHANGELOG.md Normal file
View File

@ -0,0 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 1.1.0
- updated to electron 8.0.0
- Added a beta-version of the mpris service
- Bugfixes:
- icon on gnome not showing in launcher
- app not remembering size on startup

View File

@ -33,12 +33,14 @@ Various packaged versions of the software are available on the [releases](https:
To install with `snap` you need to download the pre-packaged snap-package from this repository, found under releases:
1) Download:
1. Download:
```sh
wget <URI> #for instance: https://github.com/Mastermindzh/tidal-hifi/releases/download/1.0/tidal-hifi_1.0.0_amd64.snap
```
2) Install:
2. Install:
```sh
snap install --dangerous <path> #for instance: tidal-hifi_1.0.0_amd64.snap
```
@ -67,13 +69,13 @@ To install and work with the code on this project follow these steps:
- Shortcuts ([source](https://defkey.com/tidal-desktop-shortcuts))
- API for status and playback
- [Settings feature](./docs/settings.png) to disable certain functionality. (`ctrl+/`)
- Tray(/mini) player (coming soon)
## Integrations
- [i3 blocks config](https://github.com/Mastermindzh/dotfiles/commit/9714b2fa1d670108ce811d5511fd3b7a43180647) - My dotfiles where I use this app to fetch currently playing music (direct commit)
### Known bugs
- [Last.fm login doesn't work](https://github.com/Mastermindzh/tidal-hifi/issues/4).
## Why

View File

@ -14,6 +14,20 @@ linux:
- rpm
- AppImage
- snap
- freebsd
executableName: tidal-hifi
desktop:
Encoding: UTF-8
Name: tidal-hifi
GenericName: tidal-hifi
Comment: The web version of listen.tidal.com running in electron with hifi support thanks to widevine.
Icon: assets/icon.png
StartupNotify: true
Terminal: false
Type: Application
Categories: Network;Application;Audio;Video
StartupWMClass: tidal-hifi
X-PulseAudio-Properties: media.role=music
mac:
category: public.app-category.entertainment
win:

View File

@ -1,6 +1,6 @@
pkgbase = tidal-hifi-git
pkgdesc = The web version of listen.tidal.com running in electron with hifi support thanks to widevine.
pkgver = 1.0.1
pkgver = 1.1.0
pkgrel = 1
url = https://github.com/Mastermindzh/tidal-hifi
arch = x86_64
@ -11,7 +11,7 @@ pkgbase = tidal-hifi-git
depends = nss
depends = gtk3
provides = tidal-hifi
source = https://github.com/Mastermindzh/tidal-hifi/archive/1.0.1.zip
source = https://github.com/Mastermindzh/tidal-hifi/archive/1.1.0.zip
source = tidal-hifi.desktop
sha512sums = b855f6530b945e4b0f7891c04a8b0279cf642d9cfcf180b8ded629a85743899ac431d3de87fcecb605fae82e1df2dc86d0a72c3cc85d426bf8fe08b41630c299
sha512sums = fa5fa918ea890baa5f500db3153a6eff3d63966528ffa3349acda3ea02fbecb1ea78a1ba1d23ef7402de2228fc0a483252e0b7e72c73cfb25ed401bedaf856f5

View File

@ -2,7 +2,7 @@
_pkgname=tidal-hifi
pkgname="$_pkgname-git"
pkgver=1.0.1
pkgver=1.1.0
pkgrel=1
pkgdesc="The web version of listen.tidal.com running in electron with hifi support thanks to widevine."
arch=("x86_64")

View File

@ -10,3 +10,4 @@ Terminal=false
Type=Application
Categories=Network;Application;Audio;Video
StartupWMClass=tidal-hifi
X-PulseAudio-Properties=media.role=music

985
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "tidal-hifi",
"version": "1.0.1",
"version": "1.1.0",
"description": "Tidal on Electron with widevine(hifi) support",
"main": "src/main.js",
"scripts": {
@ -30,10 +30,11 @@
},
"devDependencies": {
"@mastermindzh/prettier-config": "^1.0.0",
"electron": "git+https://github.com/castlabs/electron-releases.git#v6.1.0-wvvmp",
"electron": "git+https://github.com/castlabs/electron-releases.git#v8.5.2-wvvmp",
"electron-builder": "^21.2.0",
"electron-reload": "^1.5.0",
"prettier": "^2.0.4"
"prettier": "^2.0.4",
"dot-prop": ">=4.2.1"
},
"prettier": "@mastermindzh/prettier-config"
}

View File

@ -17,6 +17,7 @@ const settings = {
root: "apiSettings",
port: "apiSettings.port",
},
mpris: "mpris",
windowBounds: {
root: "windowBounds",
width: "windowBounds.width",

View File

@ -34,8 +34,8 @@ function createWindow(options = {}) {
mainWindow = new BrowserWindow({
x: options.x,
y: options.y,
width: 1024,
height: 800,
width: store && store.get(settings.windowBounds.width),
height: store && store.get(settings.windowBounds.height),
icon,
tray: true,
backgroundColor: options.backgroundColor,
@ -43,7 +43,7 @@ function createWindow(options = {}) {
affinity: "window",
preload: path.join(__dirname, "preload.js"),
plugins: true,
devTools: !app.isPackaged,
devTools: true, // I like tinkering, others might too
},
});

View File

@ -17,6 +17,7 @@ function refreshSettings() {
api.checked = store.get(settings.api);
port.value = store.get(settings.apiSettings.port);
menuBar.checked = store.get(settings.menuBar);
mpris.checked = store.get(settings.mpris);
}
/**
@ -66,7 +67,7 @@ window.addEventListener("DOMContentLoaded", () => {
refreshSettings();
});
ipcRenderer.on("goToTab", (event, tab) => {
ipcRenderer.on("goToTab", (_, tab) => {
document.getElementById(tab).click();
});
@ -75,6 +76,7 @@ window.addEventListener("DOMContentLoaded", () => {
api = get("apiCheckbox");
port = get("port");
menuBar = get("menuBar");
mpris = get("mprisCheckbox");
refreshSettings();
@ -83,4 +85,5 @@ window.addEventListener("DOMContentLoaded", () => {
addInputListener(api, settings.api);
addInputListener(port, settings.apiSettings.port);
addInputListener(menuBar, settings.menuBar);
addInputListener(mpris, settings.mpris);
});

View File

@ -26,14 +26,19 @@
<div class="body">
<div class="tabset">
<!-- Tab 1 -->
<input type="radio" name="tabset" id="tab1" checked />
<label for="tab1">General</label>
<input type="radio" name="tabset" id="general" checked />
<label for="general">General</label>
<!-- Tab 2 -->
<input type="radio" name="tabset" id="tab2" />
<label for="tab2">Api</label>
<!-- Tab 3 -->
<input type="radio" name="tabset" id="tab3" />
<label for="tab3">About</label>
<input type="radio" name="tabset" id="api" />
<label for="api">Api</label>
<!-- Integrations tab -->
<input type="radio" name="tabset" id="integrations" />
<label for="integrations">Integrations</label>
<!-- about tab -->
<input type="radio" name="tabset" id="about" />
<label for="about">About</label>
<div class="tab-panels">
<section id="general" class="tab-panel">
@ -101,7 +106,29 @@
</div>
<button onClick="restart()">Restart Tidal-hifi</button>
</section>
<section id="general" class="tab-panel">
<section id="integrations" class="tab-panel">
<div class="section">
<h3>integrations</h3>
<p style="margin-bottom: 15px;">
Tidal-hifi is extensible trough the use of integrations. You can enable or disable integrations here
<br />
* not all integrations require restarting but some do, your best bet is to restart :)
</p>
<!-- disabled until the 403 with mpris-service/dbus is fixed -->
<!-- <div class="option">
<h4>mpris-player</h4>
<p>
Whether to enable the mpris media player controls for Linux systems
</p>
<label class="switch">
<input id="mprisCheckbox" type="checkbox">
<span class="slider round"></span>
</label>
</div> -->
<button onClick="restart()">Restart Tidal-hifi</button>
</div>
</section>
<section id="about" class="tab-panel">
<div class="section">
<img style="width: 100px; height: auto; display: block; margin: 0 auto; margin-bottom: 20px; margin-top: 20px;" src = "./icon.png">
<p style="max-width: 350px; display:block; margin: 0 auto; text-align: center;">
@ -170,6 +197,7 @@
.exitWindow {
border: none;
outline: none;
text-decoration: none;
font-size: 1.4rem;
float: right;
@ -178,6 +206,11 @@
line-height: 50px;
}
.exitWindow:focus {
border: none;
outline: none;
}
.exitWindow svg {
height: 50px;
color: white;
@ -263,7 +296,9 @@
.tabset > input:first-child:checked ~ .tab-panels > .tab-panel:first-child,
.tabset > input:nth-child(3):checked ~ .tab-panels > .tab-panel:nth-child(2),
.tabset > input:nth-child(5):checked ~ .tab-panels > .tab-panel:nth-child(3) {
.tabset > input:nth-child(5):checked ~ .tab-panels > .tab-panel:nth-child(3),
.tabset > input:nth-child(7):checked ~ .tab-panels > .tab-panel:nth-child(4)
{
display: block;
}

View File

@ -1,5 +1,5 @@
const { setTitle, getTitle } = require("./scripts/window-functions");
const { dialog } = require("electron").remote;
const { dialog, process } = require("electron").remote;
const { store, settings } = require("./scripts/settings");
const { ipcRenderer } = require("electron");
const { app } = require("electron").remote;
@ -10,6 +10,7 @@ const globalEvents = require("./constants/globalEvents");
const notifier = require("node-notifier");
const notificationPath = `${app.getPath("userData")}/notification.jpg`;
let currentSong = "";
// let player;
const elements = {
play: '*[data-test="play"]',
@ -216,13 +217,22 @@ function addIPCEventListeners() {
* Update the current status of tidal (e.g playing or paused)
*/
function updateStatus() {
const play = elements.get("play");
let status = statuses.paused;
// if play button is NOT visible tidal is playing
if (!play) {
let pause = elements.get("pause");
let status;
// if pause button is visible tidal is playing
if (pause) {
status = statuses.playing;
} else {
status = statuses.paused;
}
if (status) {
ipcRenderer.send(globalEvents.updateStatus, status);
// if (player) {
// player.playbackStatus = status == statuses.paused ? "Paused" : "Playing";
// }
}
}
/**
@ -264,6 +274,17 @@ 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,
// },
// };
// }
},
() => {}
);
@ -271,5 +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",
// });
// // 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);
// }
// });
// });
// player.on("quit", function () {
// app.quit();
// });
// } catch (exception) {
// console.log("player api not working");
// }
// }
addHotKeys();
addIPCEventListeners();

View File

@ -89,7 +89,7 @@ const mainMenu = [
{
label: "About",
click() {
showSettingsWindow("tab3");
showSettingsWindow("about");
},
},
];

View File

@ -14,7 +14,7 @@ const store = new Store({
apiSettings: {
port: 47836,
},
mpris: false,
windowBounds: { width: 800, height: 600 },
},
});
@ -52,7 +52,7 @@ settingsModule.createSettingsWindow = function() {
settingsModule.settingsWindow = settingsWindow;
};
settingsModule.showSettingsWindow = function(tab = "tab1") {
settingsModule.showSettingsWindow = function (tab = "general") {
settingsWindow.webContents.send("goToTab", tab);
// refresh data just before showing the window