Shuffle play a playlist with mpv includes a webui
Go to file
2024-11-03 20:22:07 +00:00
example_config.sh initial commit 2024-11-03 19:54:30 +00:00
LICENSE Initial commit 2024-11-03 20:51:14 +01:00
mpvmusic.sh check for emptyness not non existence of variable 2024-11-03 20:14:13 +00:00
README.md fixed dependency bit in readme 2024-11-03 20:22:07 +00:00

mpvmusic

Shuffle play a playlist with mpv
includes a webui

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"')
	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.