mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 15:02:42 +01:00
music source and client for subsonic
test fixture setup for navidrome
This commit is contained in:
1
docker/library-manager/scripts/util/env.ts
Normal file
1
docker/library-manager/scripts/util/env.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const MUSIC_DIR = Deno.env.get("MUSIC_DIR") ?? "/music";
|
||||
24
docker/library-manager/scripts/util/subsonic.ts
Normal file
24
docker/library-manager/scripts/util/subsonic.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export class SubsonicClient {
|
||||
constructor(
|
||||
readonly baseUrl: string,
|
||||
readonly username: string,
|
||||
readonly password: string,
|
||||
) {}
|
||||
|
||||
get(method: string, params?: Record<string, string>) {
|
||||
const url = new URL(`rest/${method}.view`, this.baseUrl);
|
||||
|
||||
url.searchParams.set("u", this.username);
|
||||
url.searchParams.set("p", this.password);
|
||||
url.searchParams.set("v", "1.13.0");
|
||||
url.searchParams.set("c", "subtracks-test-fixture");
|
||||
|
||||
if (params) {
|
||||
Object.entries(params).forEach(([key, value]) =>
|
||||
url.searchParams.append(key, value)
|
||||
);
|
||||
}
|
||||
|
||||
return fetch(url);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user