Shuffle play a playlist with mpv
includes a webui
example_config.sh | ||
LICENSE | ||
mpvmusic.sh | ||
README.md |
mpvmusic webui
A basic webui for mpv --shuffle
Dependencies
exiftool
jq
mpv
# Debian based
$ sudo apt install exiftool jq mpv
# Arch
$ sudo pacman -Syu exiftool jq mpv
# Should work on other systems too, these are pretty universal programs
Intergrating with a node web server
You'll need these functions in your node server:
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"')
setTimeout(function() {
res.redirect(302, req.get("referer"));
}, 750);
});
app.post("/music/prev",(req,res) => {
console.log("going back to previous song")
exec('echo playlist-prev | socat - "/tmp/mpvsocket"')
setTimeout(function() {
res.redirect(302, req.get("referer"));
}, 750);
});
Change the "/music/{event}" to wherever your webui posts to.