mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-24 22:42:42 +01:00
Merge branch 'master' of github.com:Mastermindzh/tidal-hifi
This commit is contained in:
commit
da0893392a
@ -4,6 +4,10 @@ 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).
|
||||
|
||||
## [5.12.0]
|
||||
|
||||
- Added Shuffle and Repeat state to API response - By [ThatGravyBoat](https://github.com/ThatGravyBoat)
|
||||
|
||||
## [5.11.0]
|
||||
|
||||
- Re-implemented the API, added support for duration/current in seconds & shuffle+repeat
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "tidal-hifi",
|
||||
"version": "5.11.0",
|
||||
"version": "5.12.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tidal-hifi",
|
||||
"version": "5.11.0",
|
||||
"version": "5.12.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@electron/remote": "^2.1.2",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tidal-hifi",
|
||||
"version": "5.11.0",
|
||||
"version": "5.12.0",
|
||||
"description": "Tidal on Electron with widevine(hifi) support",
|
||||
"main": "ts-dist/main.js",
|
||||
"scripts": {
|
||||
|
@ -2,6 +2,8 @@ import { TidalState } from "../models/tidalState";
|
||||
|
||||
export const mainTidalState: TidalState = {
|
||||
status: "Stopped",
|
||||
repeat: "Off",
|
||||
shuffle: false,
|
||||
};
|
||||
|
||||
export function getLegacyMediaInfo() {
|
||||
@ -25,5 +27,10 @@ export function getLegacyMediaInfo() {
|
||||
durationInSeconds: mainTidalState.currentTrack?.duration ?? 0,
|
||||
image: "tidal-hifi-icon",
|
||||
favorite: false,
|
||||
player: {
|
||||
status: mainTidalState.status.toLowerCase(),
|
||||
shuffle: mainTidalState.shuffle,
|
||||
repeat: mainTidalState.repeat,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
export type TidalState = {
|
||||
status: "Playing" | "Paused" | "Stopped";
|
||||
repeat: "Off" | "All" | "Single";
|
||||
shuffle: boolean;
|
||||
currentTrack?: {
|
||||
id: number;
|
||||
title: string;
|
||||
|
@ -433,7 +433,7 @@
|
||||
<h4>TIDAL Hi-Fi</h4>
|
||||
<div class="about-section__version">
|
||||
<a target="_blank" rel="noopener"
|
||||
href="https://github.com/Mastermindzh/tidal-hifi/releases/tag/5.11.0">5.11.0</a>
|
||||
href="https://github.com/Mastermindzh/tidal-hifi/releases/tag/5.12.0">5.12.0</a>
|
||||
</div>
|
||||
<div class="about-section__links">
|
||||
<a target="_blank" rel="noopener" href="https://github.com/mastermindzh/tidal-hifi/"
|
||||
|
@ -85,7 +85,7 @@ export type ReduxState = {
|
||||
};
|
||||
};
|
||||
|
||||
const enum RepeatMode {
|
||||
export const enum RepeatMode {
|
||||
REPEAT_OFF = 0,
|
||||
REPEAT_ALL = 1,
|
||||
REPEAT_SINGLE = 2,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { getTidalReduxStore, ReduxState, TidalReduxStore } from "./redux";
|
||||
import { getTidalReduxStore, ReduxState, RepeatMode, TidalReduxStore } from "./redux";
|
||||
import { createStore } from "zustand/vanilla";
|
||||
import { ipcRenderer } from "electron";
|
||||
import { globalEvents } from "../constants/globalEvents";
|
||||
@ -7,6 +7,8 @@ import { TidalState } from "../models/tidalState";
|
||||
|
||||
export const $tidalState = createStore<TidalState>(() => ({
|
||||
status: "Stopped",
|
||||
repeat: "Off",
|
||||
shuffle: false,
|
||||
}));
|
||||
|
||||
export let reduxStore: TidalReduxStore | undefined;
|
||||
@ -133,8 +135,10 @@ export const coverArtPaths = new Map<string, Promise<string>>();
|
||||
};
|
||||
}
|
||||
const oldState = $tidalState.getState();
|
||||
const newState = {
|
||||
const newState: TidalState = {
|
||||
status: playbackStatusMap[state.playbackControls.playbackState] ?? "Stopped",
|
||||
repeat: repeatModeMap[state.playQueue.repeatMode] ?? "Off",
|
||||
shuffle: state.playQueue.shuffleModeEnabled,
|
||||
currentTrack: track,
|
||||
};
|
||||
if (!equal(oldState, newState)) {
|
||||
@ -153,3 +157,9 @@ const playbackStatusMap = {
|
||||
IDLE: "Stopped",
|
||||
STALLED: "Stopped",
|
||||
} as const;
|
||||
|
||||
const repeatModeMap = {
|
||||
[RepeatMode.REPEAT_OFF]: "Off",
|
||||
[RepeatMode.REPEAT_ALL]: "All",
|
||||
[RepeatMode.REPEAT_SINGLE]: "Single",
|
||||
} as const;
|
||||
|
@ -3,4 +3,6 @@ import { TidalState } from "../models/tidalState";
|
||||
// This object is globally mutated
|
||||
export const tidalState: TidalState = {
|
||||
status: "Stopped",
|
||||
repeat: "Off",
|
||||
shuffle: false,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user