Add simple listing of sonos devices and basic Dockefile for running it

This commit is contained in:
simojenki
2021-01-29 12:34:02 +11:00
parent da61f079bc
commit 769a3e50d4
14 changed files with 935 additions and 45 deletions

20
src/music_service.ts Normal file
View File

@@ -0,0 +1,20 @@
import axios from "axios";
import { Md5 } from "ts-md5/dist/md5";
const s = "foobar100";
const navidrome = process.env["BONOB_NAVIDROME_URL"];
const u = process.env["BONOB_USER"];
const t = Md5.hashStr(`${process.env["BONOB_PASSWORD"]}${s}`);
export class Navidrome {
ping = (): Promise<boolean> =>
axios
.get(
`${navidrome}/rest/ping.view?u=${u}&t=${t}&s=${s}&v=1.16.1.0&c=myapp`
)
.then((_) => true)
.catch((e) => {
console.log(e);
return false;
});
}