This commit is contained in:
DeaDvey 2024-11-03 20:19:47 +00:00
parent d8496a0b78
commit 0163ac721b

View File

@ -1,4 +1,38 @@
# mpvmusic
Shuffle play a playlist with mpv
includes a webui
Shuffle play a playlist with mpv<br/>
includes a webui<br/>
## Dependencies
mpv
jq
exiftool
## Intergrating with a node web server
You'll need these functions in your node server:
```javascript
const express = require('express');
const { exec } = require("child_process");
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.post("/music/playpause",(req,res) => {
console.log("toggling pause!")
exec('echo cycle pause | socat - "/tmp/mpvsocket"');
res.redirect(302, req.get("referer"));
});
app.post("/music/next",(req,res) => {
console.log("skipping to next song")
exec('echo playlist-next | socat - "/tmp/mpvsocket"')
res.redirect(302, req.get("referer"));
});
app.post("/music/prev",(req,res) => {
console.log("going back to previous song")
exec('echo playlist-prev | socat - "/tmp/mpvsocket"')
res.redirect(302, req.get("referer"));
});
```
Change the "/music/{event}" to wherever your webui posts to.