Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b55e1dd0a6 | ||
|
|
49f04ef82f | ||
|
|
862401fa9b | ||
|
|
20e94a7e0e | ||
|
|
7f2b8ce5aa | ||
|
|
14df9ae2cd | ||
|
|
36f2535cf8 | ||
|
|
3dfa3007bf | ||
|
|
e80ff5fece |
10
dist/index.d.ts
vendored
10
dist/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
export * from "./fastify";
|
export * from "./fastify.js";
|
||||||
export * from "./homeassistant";
|
export * from "./homeassistant.js";
|
||||||
export * from "./logger";
|
export * from "./logger.js";
|
||||||
export * from "./tidal";
|
export * from "./tidal.js";
|
||||||
export * from "./timehelper";
|
export * from "./timehelper.js";
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
||||||
2
dist/index.d.ts.map
vendored
2
dist/index.d.ts.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
||||||
10
dist/index.js
vendored
10
dist/index.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
export * from "./fastify";
|
export * from "./fastify.js";
|
||||||
export * from "./homeassistant";
|
export * from "./homeassistant.js";
|
||||||
export * from "./logger";
|
export * from "./logger.js";
|
||||||
export * from "./tidal";
|
export * from "./tidal.js";
|
||||||
export * from "./timehelper";
|
export * from "./timehelper.js";
|
||||||
|
|||||||
18
dist/tidal.d.ts
vendored
18
dist/tidal.d.ts
vendored
@@ -1,14 +1,26 @@
|
|||||||
export type TidalSong = {
|
export type TidalGetCurrent = {
|
||||||
title: string;
|
title: string;
|
||||||
artists: string;
|
artists: string;
|
||||||
|
artistsArray: string[];
|
||||||
album: string;
|
album: string;
|
||||||
playingFrom: string;
|
playingFrom: string;
|
||||||
status: "playing" | "paused";
|
status: "playing" | "paused";
|
||||||
url: string;
|
url: string;
|
||||||
current: string;
|
current: string;
|
||||||
|
currentInSeconds: number;
|
||||||
duration: string;
|
duration: string;
|
||||||
};
|
durationInSeconds: number;
|
||||||
export type TidalVolume = {
|
image: string;
|
||||||
|
icon: string;
|
||||||
|
localAlbumArt: string;
|
||||||
|
favorite: boolean;
|
||||||
|
trackId: string;
|
||||||
volume: number;
|
volume: number;
|
||||||
|
player: {
|
||||||
|
status: "playing" | "paused";
|
||||||
|
shuffle: boolean;
|
||||||
|
repeat: "all" | "single" | "none";
|
||||||
|
};
|
||||||
|
artist: string;
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=tidal.d.ts.map
|
//# sourceMappingURL=tidal.d.ts.map
|
||||||
2
dist/tidal.d.ts.map
vendored
2
dist/tidal.d.ts.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tidal.d.ts","sourceRoot":"","sources":["../src/tidal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
{"version":3,"file":"tidal.d.ts","sourceRoot":"","sources":["../src/tidal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACP,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC7B,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;KAClC,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CACf,CAAC"}
|
||||||
3
dist/timehelper.d.ts
vendored
3
dist/timehelper.d.ts
vendored
@@ -1,7 +1,8 @@
|
|||||||
export declare class TimeSpan {
|
export declare class TimeSpan {
|
||||||
private start;
|
private start;
|
||||||
private end;
|
private end;
|
||||||
constructor(timeSpanStr: string);
|
private timeZone;
|
||||||
|
constructor(timeSpanStr: string, timeZone: string);
|
||||||
private parseTime;
|
private parseTime;
|
||||||
contains(timestamp?: number): boolean;
|
contains(timestamp?: number): boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/timehelper.d.ts.map
vendored
2
dist/timehelper.d.ts.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"timehelper.d.ts","sourceRoot":"","sources":["../src/timehelper.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,GAAG,CAAqC;gBAEpC,WAAW,EAAE,MAAM;IAM/B,OAAO,CAAC,SAAS;IAKjB,QAAQ,CAAC,SAAS,GAAE,MAAmB,GAAG,OAAO;CAgBlD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;CAClD;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,WAAW,CAOb;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR"}
|
{"version":3,"file":"timehelper.d.ts","sourceRoot":"","sources":["../src/timehelper.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,GAAG,CAAqC;IAChD,OAAO,CAAC,QAAQ,CAAC;gBAEL,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOjD,OAAO,CAAC,SAAS;IAKjB,QAAQ,CAAC,SAAS,GAAE,MAAmB,GAAG,OAAO;CAqBlD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;CAClD;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,WAAW,CAOb;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR"}
|
||||||
13
dist/timehelper.js
vendored
13
dist/timehelper.js
vendored
@@ -1,10 +1,12 @@
|
|||||||
export class TimeSpan {
|
export class TimeSpan {
|
||||||
start;
|
start;
|
||||||
end;
|
end;
|
||||||
constructor(timeSpanStr) {
|
timeZone;
|
||||||
|
constructor(timeSpanStr, timeZone) {
|
||||||
const [startStr, endStr] = timeSpanStr.split("-");
|
const [startStr, endStr] = timeSpanStr.split("-");
|
||||||
this.start = this.parseTime(startStr);
|
this.start = this.parseTime(startStr);
|
||||||
this.end = this.parseTime(endStr);
|
this.end = this.parseTime(endStr);
|
||||||
|
this.timeZone = timeZone;
|
||||||
}
|
}
|
||||||
parseTime(timeStr) {
|
parseTime(timeStr) {
|
||||||
const [hours, minutes] = timeStr.split(":").map(Number);
|
const [hours, minutes] = timeStr.split(":").map(Number);
|
||||||
@@ -12,8 +14,13 @@ export class TimeSpan {
|
|||||||
}
|
}
|
||||||
contains(timestamp = Date.now()) {
|
contains(timestamp = Date.now()) {
|
||||||
const date = new Date(timestamp);
|
const date = new Date(timestamp);
|
||||||
const hours = date.getHours();
|
const berlinTimeStr = date.toLocaleString("de-DE", {
|
||||||
const minutes = date.getMinutes();
|
timeZone: this.timeZone, // "Europe/Berlin"
|
||||||
|
hour12: false,
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
});
|
||||||
|
const [hours, minutes] = berlinTimeStr.split(":").map(Number);
|
||||||
const currentMinutes = hours * 60 + minutes;
|
const currentMinutes = hours * 60 + minutes;
|
||||||
const startMinutes = this.start.hours * 60 + this.start.minutes;
|
const startMinutes = this.start.hours * 60 + this.start.minutes;
|
||||||
const endMinutes = this.end.hours * 60 + this.end.minutes;
|
const endMinutes = this.end.hours * 60 + this.end.minutes;
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@dpu/shared",
|
"name": "@dpu/shared",
|
||||||
"version": "1.2.5",
|
"version": "1.4.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@dpu/shared",
|
"name": "@dpu/shared",
|
||||||
"version": "1.2.5",
|
"version": "1.4.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"chalk": "^5.6.2",
|
"chalk": "^5.6.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dpu/shared",
|
"name": "@dpu/shared",
|
||||||
"version": "1.2.5",
|
"version": "1.4.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
19
src/tidal.ts
19
src/tidal.ts
@@ -1,14 +1,25 @@
|
|||||||
export type TidalSong = {
|
export type TidalGetCurrent = {
|
||||||
title: string;
|
title: string;
|
||||||
artists: string;
|
artists: string;
|
||||||
|
artistsArray: string[];
|
||||||
album: string;
|
album: string;
|
||||||
playingFrom: string;
|
playingFrom: string;
|
||||||
status: "playing" | "paused";
|
status: "playing" | "paused";
|
||||||
url: string;
|
url: string;
|
||||||
current: string;
|
current: string;
|
||||||
|
currentInSeconds: number;
|
||||||
duration: string;
|
duration: string;
|
||||||
};
|
durationInSeconds: number;
|
||||||
|
image: string;
|
||||||
export type TidalVolume = {
|
icon: string;
|
||||||
|
localAlbumArt: string;
|
||||||
|
favorite: boolean;
|
||||||
|
trackId: string;
|
||||||
volume: number;
|
volume: number;
|
||||||
|
player: {
|
||||||
|
status: "playing" | "paused";
|
||||||
|
shuffle: boolean;
|
||||||
|
repeat: "all" | "single" | "none";
|
||||||
|
};
|
||||||
|
artist: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
export class TimeSpan {
|
export class TimeSpan {
|
||||||
private start: { hours: number; minutes: number };
|
private start: { hours: number; minutes: number };
|
||||||
private end: { hours: number; minutes: number };
|
private end: { hours: number; minutes: number };
|
||||||
|
private timeZone;
|
||||||
|
|
||||||
constructor(timeSpanStr: string) {
|
constructor(timeSpanStr: string, timeZone: string) {
|
||||||
const [startStr, endStr] = timeSpanStr.split("-");
|
const [startStr, endStr] = timeSpanStr.split("-");
|
||||||
this.start = this.parseTime(startStr);
|
this.start = this.parseTime(startStr);
|
||||||
this.end = this.parseTime(endStr);
|
this.end = this.parseTime(endStr);
|
||||||
|
this.timeZone = timeZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseTime(timeStr: string) {
|
private parseTime(timeStr: string) {
|
||||||
@@ -16,10 +18,15 @@ export class TimeSpan {
|
|||||||
contains(timestamp: number = Date.now()): boolean {
|
contains(timestamp: number = Date.now()): boolean {
|
||||||
const date = new Date(timestamp);
|
const date = new Date(timestamp);
|
||||||
|
|
||||||
const hours = date.getHours();
|
const berlinTimeStr = date.toLocaleString("de-DE", {
|
||||||
const minutes = date.getMinutes();
|
timeZone: this.timeZone, // "Europe/Berlin"
|
||||||
const currentMinutes = hours * 60 + minutes;
|
hour12: false,
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
});
|
||||||
|
|
||||||
|
const [hours, minutes] = berlinTimeStr.split(":").map(Number);
|
||||||
|
const currentMinutes = hours * 60 + minutes;
|
||||||
const startMinutes = this.start.hours * 60 + this.start.minutes;
|
const startMinutes = this.start.hours * 60 + this.start.minutes;
|
||||||
const endMinutes = this.end.hours * 60 + this.end.minutes;
|
const endMinutes = this.end.hours * 60 + this.end.minutes;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user