Compare commits

...

12 Commits

Author SHA1 Message Date
Darius
20e94a7e0e 1.4.0 2026-01-28 22:51:15 +01:00
Darius
7f2b8ce5aa update tidal objects 2026-01-28 22:49:54 +01:00
Darius
14df9ae2cd 1.3.0 2025-11-24 01:37:03 +01:00
Darius
36f2535cf8 add timezone to timespan 2025-11-24 01:36:55 +01:00
Darius
3dfa3007bf 1.2.6 2025-11-23 02:52:00 +01:00
Darius
e80ff5fece Generic Commit; Most likely a fix or small feature 2025-11-23 02:51:54 +01:00
Darius
694d88bb72 1.2.5 2025-11-23 02:49:14 +01:00
Darius
9569477a26 Generic Commit; Most likely a fix or small feature 2025-11-23 02:49:06 +01:00
Darius
6574f8f672 1.2.4 2025-11-23 02:45:59 +01:00
Darius
ea6605f9dc Generic Commit; Most likely a fix or small feature 2025-11-23 02:45:54 +01:00
Darius
953afcbc84 1.2.3 2025-11-21 17:36:06 +01:00
Darius
1d4ade717a Generic Commit; Most likely a fix or small feature 2025-11-21 17:35:58 +01:00
10 changed files with 64 additions and 26 deletions

5
dist/fastify.d.ts vendored
View File

@@ -3,9 +3,10 @@ export type ServiceResult<T = unknown> = {
result: T; result: T;
successful: boolean; successful: boolean;
}; };
export type API_Error = { export declare class API_Error {
error: string; error: string;
}; constructor(error: string);
}
export declare abstract class BaseClient { export declare abstract class BaseClient {
private axiosInstance; private axiosInstance;
constructor(axiosInstance: AxiosInstance); constructor(axiosInstance: AxiosInstance);

View File

@@ -1 +1 @@
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI;IACvC,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,8BAAsB,UAAU;IAC9B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,aAAa,EAAE,aAAa;IAIxC,QAAQ,IAAI,aAAa;CAG1B;AAED,8BAAsB,WAAW,CAAC,CAAC;IACjC,OAAO,CAAC,MAAM,CAAI;gBAEN,MAAM,EAAE,CAAC;IAIrB,SAAS,IAAI,CAAC;IAId,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IAO7D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;CAMrD"} {"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../src/fastify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI;IACvC,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,qBAAa,SAAS;IACD,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;CACjC;AAED,8BAAsB,UAAU;IAC9B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,aAAa,EAAE,aAAa;IAIxC,QAAQ,IAAI,aAAa;CAG1B;AAED,8BAAsB,WAAW,CAAC,CAAC;IACjC,OAAO,CAAC,MAAM,CAAI;gBAEN,MAAM,EAAE,CAAC;IAIrB,SAAS,IAAI,CAAC;IAId,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IAO7D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;CAMrD"}

6
dist/fastify.js vendored
View File

@@ -1,3 +1,9 @@
export class API_Error {
error;
constructor(error) {
this.error = error;
}
}
export class BaseClient { export class BaseClient {
axiosInstance; axiosInstance;
constructor(axiosInstance) { constructor(axiosInstance) {

View File

@@ -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;
} }

View File

@@ -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
View File

@@ -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
View File

@@ -1,12 +1,12 @@
{ {
"name": "@dpu/shared", "name": "@dpu/shared",
"version": "1.2.2", "version": "1.4.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@dpu/shared", "name": "@dpu/shared",
"version": "1.2.2", "version": "1.4.0",
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",
"chalk": "^5.6.2", "chalk": "^5.6.2",

View File

@@ -1,9 +1,10 @@
{ {
"name": "@dpu/shared", "name": "@dpu/shared",
"version": "1.2.2", "version": "1.4.0",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"type": "module",
"files": [ "files": [
"dist" "dist"
], ],

View File

@@ -1,14 +1,29 @@
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;
icon: string;
localAlbumArt: string;
favorite: boolean;
trackId: string;
volume: number;
player: {
status: "playing" | "paused";
shuffle: boolean;
repeat: "all" | "single" | "none";
};
artist: string;
}; };
export type TidalVolume = { export type TidalPutVolume = {
volume: number; volume: number;
}; };

View File

@@ -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;