You are not logged in.

#1 2013-08-14 06:34:07

goodvikings
Member
Registered: 2013-08-14
Posts: 2

Simple MPD notifications

I searched and searched, but could not find a simple MPD notification script that worked for me. So I whipped up my own, and here it is, as simple as you like.

#!/usr/bin/bash

dir="/home/ramo/Music/"

while :
do
	output=$(mpc -f "%title%\n%artist%\n%album%\n%file%" current --wait)
	if [ $? -eq 1 ]
	then
		sleep 5
	else
		i=1
		while read -r line; do
			array[$i]="$line"
			(( i++ ))
		done <<< "$output"

		file=$(ls -t "$(dirname "$dir${array[4]}")"/*.{jpg,png} 2> /dev/null | head -n 1)

		notify-send "${array[1]}" "${array[2]} - ${array[3]}" -t 5000 -i "$file"
	fi
done

Offline

#2 2013-08-14 08:47:42

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Simple MPD notifications

There are many out there.  For example: https://github.com/vehk/mpdnotify


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2013-08-14 08:56:04

goodvikings
Member
Registered: 2013-08-14
Posts: 2

Re: Simple MPD notifications

graysky wrote:

There are many out there.  For example: https://github.com/vehk/mpdnotify

I'm sure there's heaps.

Offline

Board footer

Powered by FluxBB