Compare commits

..

No commits in common. "476bda1963b1e69d14ff0dd24036677d21ca109c" and "22ac9b22816bf511fd617fcf7b4567ea9948d58a" have entirely different histories.

2 changed files with 8 additions and 8 deletions

@ -1 +1 @@
Subproject commit 06842103672ad8f394b39e5fea2c1ab4442c1f44
Subproject commit 39d52a2c8042d250f0258b1135d7d94e37a14e8f

View file

@ -1,23 +1,23 @@
#!/usr/bin/env bash
MPVPIPE=/tmp/mpvqueue.playlist
notify="notify-send -i mpv -a mpv"
url="$1"
# NOTE: You need to configure mpv to
# enable ipc server on this path (see my mpv config for an example)
MPVSOCKET="/tmp/mpvsocket"
# See if MPV is already running
if [ -z "$(pidof mpv)" ]; then
# mpv is not running
# remove fifo
rm -f $MPVPIPE && mkfifo $MPVPIPE
# pause other players
playerctl pause
# start mpv
/usr/bin/mpv --no-terminal "$url" & disown
/usr/bin/mpv --no-terminal --input-file="${MPVPIPE}" "$url" & disown
# Wait for mpv to be up before adding anything else to playlist
# Wait for mpv to be up before moving on to adding anything else to playlist
while [ -z "$(pidof mpv)" ]; do
sleep 1
done
@ -26,5 +26,5 @@ if [ -z "$(pidof mpv)" ]; then
else
# mpv is running, so add stuff to playlist
$notify "Adding $url"
echo "{\"command\": [\"loadfile\", \"$url\", \"append\"]}" | socat - /tmp/mpvsocket
echo "loadfile \"$url\" append-play" >> "${MPVPIPE}"
fi