#!/bin/bash
MESSAGE='-mesg Append:'
if [ "$1" = "--clear" ]; then
MESSAGE='-mesg Replace:'
fi
PLAYLIST="$(mpc lsplaylists | rofi -lines 10 -dmenu -p 'Play MPD Playlist: ' $MESSAGE)"
if [ "$PLAYLIST" = "" ]; then
exit
mpc clear
mpc load $PLAYLIST
if [[ "$(mpc)" != *"playing"* ]]; then
mpc play
notify-send -u low -t 5 -a 'Mopidy' "$PLAYLIST" "Beginning playback of playlist $PLAYLIST"