add mpd config

This commit is contained in:
XenGi 2023-10-18 00:40:17 +02:00
parent 93d7af271d
commit c746d81063
Signed by: xengi
SSH key fingerprint: SHA256:FGp51kRvGOcWnTHiOI39ImwVO4A3fpvR30nPX3LpV7g
4 changed files with 50 additions and 2 deletions

View file

@ -11,6 +11,8 @@
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bun
mpd
mpc-cli
];
};
}

13
mpd.conf Normal file
View file

@ -0,0 +1,13 @@
audio_output {
type "pipewire"
name "PipeWire Sound Server"
}
db_file "/tmp/sanic/mpd_db"
auto_update "yes"
music_directory "/tmp/sanic/music"
playlist_directory "/tmp/sanic/playlists"
zeroconf_enabled "yes"
zeroconf_name "sanic dev server"
log_level "info"

View file

@ -3,7 +3,9 @@
"module": "server.ts",
"type": "module",
"scripts": {
"start": "bun run server.ts"
"start": "bun run server.ts",
"init": "mkdir -p /tmp/sanic/{music,playlists}; touch /tmp/sanic/mpd_db",
"mpd": "mpd --no-daemon ./mpd.conf"
},
"devDependencies": {
"bun-types": "latest"

View file

@ -1 +1,32 @@
console.log("Hello via Bun!");
// Run websocket server
const wsServer = Bun.serve({
port: 8080,
fetch(req, server) {
// upgrade the request to a WebSocket
if (server.upgrade(req)) {
return; // do not return a Response
}
return new Response("Upgrade failed :(", { status: 500 });
},
websocket: {
message(ws, message) { // a message is received
ws.send(message); // echo back the message
},
open(ws) {}, // a socket is opened
close(ws, code, message) {}, // a socket is closed
drain(ws) {}, // the socket is ready to receive more data
},
});
// Run web server
const webServer = Bun.serve({
port: 8000,
//unix: "/run/sanic.sock",
fetch(req) {
return new Response("Put frontend here!");
},
});
console.log(`Listening on http://localhost:${webServer.port} ...`);
console.log(`Listening on ws://localhost:${wsServer.port} ...`);