summaryrefslogtreecommitdiff
path: root/contrib/eventcmd-examples/eventcmd.sh
blob: 7e2872a3a62b148a58681c52f5f85637b4a44d67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

# create variables
while read L; do
	k="`echo "$L" | cut -d '=' -f 1`"
	v="`echo "$L" | cut -d '=' -f 2`"
	export "$k=$v"
done < <(grep -e '^\(title\|artist\|album\|stationName\|songStationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|coverArt\|stationCount\|station[0-9]*\)=' /dev/stdin) # don't overwrite $1...

case "$1" in
#	songstart)
#		echo 'naughty.notify({title = "pianobar", text = "Now playing: ' "$title" ' by ' "$artist" '"})' | awesome-client -

#		echo "$title -- $artist" > $HOME/.config/pianobar/nowplaying

#		if [ "$rating" -eq 1 ]
#		then
#			kdialog --title pianobar --passivepopup "'$title' by '$artist' on '$album' - LOVED" 10
#		else
#			kdialog --title pianobar --passivepopup "'$title' by '$artist' on '$album'" 10
#		fi
#		# show an OS X notification
#		osascript -e "display notification \"$album\" with title \"$title\" subtitle \"$artist\""
#		# or whatever you like...
#		;;

#	songfinish)
#		# scrobble if 75% of song have been played, but only if the song hasn't
#		# been banned
#		if [ -n "$songDuration" ] && [ "$songDuration" -ne 0 ] &&
#				[ $(echo "scale=4; ($songPlayed/$songDuration*100)>50" | bc) -eq 1 ] &&
#				[ "$rating" -ne 2 ]; then
#			# scrobbler-helper is part of the Audio::Scrobble package at cpan
#			# "pia" is the last.fm client identifier of "pianobar", don't use
#			# it for anything else, please
#			scrobbler-helper -P pia -V 1.0 "$title" "$artist" "$album" "" "" "" "$((songDuration/1000))" &
#		fi
#		;;

#	songlove)
#		kdialog --title pianobar --passivepopup "LOVING '$title' by '$artist' on '$album' on station '$stationName'" 10
#		;;

#	songshelf)
#		kdialog --title pianobar --passivepopup "SHELVING '$title' by '$artist' on '$album' on station '$stationName'" 10
#		;;

#	songban)
#		kdialog --title pianobar --passivepopup "BANNING '$title' by '$artist' on '$album' on station '$stationName'" 10
#		;;

#	songbookmark)
#		kdialog --title pianobar --passivepopup "BOOKMARKING '$title' by '$artist' on '$album'" 10
#		;;

#	artistbookmark)
#		kdialog --title pianobar --passivepopup "BOOKMARKING '$artist'" 10
#		;;

	*)
		if [ "$pRet" -ne 1 ]; then
			echo "naughty.notify({title = \"pianobar\", text = \"$1 failed: $pRetStr\"})" | awesome-client -
#			kdialog --title pianobar --passivepopup "$1 failed: $pRetStr"
		elif [ "$wRet" -ne 1 ]; then
			echo "naughty.notify({title = \"pianobar\", text = \"$1 failed: Network error: $wRetStr\"})" | awesome-client -
#			kdialog --title pianobar --passivepopup "$1 failed: Network error: $wRetStr"
		fi
		;;
esac