mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-08-23 21:15:00 +02:00
feat: reworked the api, added duration/current in seconds + shuffle & repeat
This commit is contained in:
@@ -12,6 +12,7 @@ import { StoreData } from "./features/listenbrainz/models/storeData";
|
||||
import { Logger } from "./features/logger";
|
||||
import { Songwhip } from "./features/songwhip/songwhip";
|
||||
import { addCustomCss } from "./features/theming/theming";
|
||||
import { convertDurationToSeconds } from "./features/time/parse";
|
||||
import { MediaStatus } from "./models/mediaStatus";
|
||||
import { Options } from "./models/options";
|
||||
import { downloadFile } from "./scripts/download";
|
||||
@@ -318,6 +319,12 @@ function addIPCEventListeners() {
|
||||
case globalEvents.toggleFavorite:
|
||||
elements.click("favorite");
|
||||
break;
|
||||
case globalEvents.toggleShuffle:
|
||||
elements.click("shuffle");
|
||||
break;
|
||||
case globalEvents.toggleRepeat:
|
||||
elements.click("repeat");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -523,7 +530,9 @@ setInterval(function () {
|
||||
status: currentStatus,
|
||||
url: getTrackURL(),
|
||||
current,
|
||||
currentInSeconds: convertDurationToSeconds(current),
|
||||
duration,
|
||||
durationInSeconds: convertDurationToSeconds(duration),
|
||||
"app-name": appName,
|
||||
image: "",
|
||||
icon: "",
|
||||
@@ -560,7 +569,10 @@ setInterval(function () {
|
||||
});
|
||||
} else {
|
||||
// just update the time
|
||||
updateMediaInfo({ ...currentMediaInfo, ...{ current } }, false);
|
||||
updateMediaInfo(
|
||||
{ ...currentMediaInfo, ...{ current, currentInSeconds: convertDurationToSeconds(current) } },
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user