~ubuntu-branches/ubuntu/quantal/pianobar/quantal

« back to all changes in this revision

Viewing changes to contrib/eventcmd.sh

  • Committer: Bazaar Package Importer
  • Author(s): Luke Faraone
  • Date: 2011-07-09 10:03:03 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110709100303-m5heshhcrbrv3w3n
Tags: 2011.07.09-1
* New upstream version. 
  - XMLRPC api version bump (v31) (closes: #633345, LP: #807860)
* Update debian/watch for new location.
* Update symbols file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
# create variables
4
 
while read L; do
5
 
        k="`echo "$L" | cut -d '=' -f 1`"
6
 
        v="`echo "$L" | cut -d '=' -f 2`"
7
 
        export "$k=$v"
8
 
done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|coverArt\|stationCount\|station[0-9]*\)=' /dev/stdin) # don't overwrite $1...
9
 
 
10
 
case "$1" in
11
 
#       songstart)
12
 
#               echo 'naughty.notify({title = "pianobar", text = "Now playing: ' "$title" ' by ' "$artist" '"})' | awesome-client -
13
 
#               echo "$title -- $artist" > $HOME/.config/pianobar/nowplaying
14
 
#               # or whatever you like...
15
 
#               ;;
16
 
 
17
 
#       songfinish)
18
 
#               # scrobble if 75% of song have been played, but only if the song hasn't
19
 
#               # been banned
20
 
#               if [ -n "$songDuration" ] &&
21
 
#                               [ $(echo "scale=4; ($songPlayed/$songDuration*100)>50" | bc) -eq 1 ] &&
22
 
#                               [ "$rating" -ne 2 ]; then
23
 
#                       # scrobbler-helper is part of the Audio::Scrobble package at cpan
24
 
#                       # "pia" is the last.fm client identifier of "pianobar", don't use
25
 
#                       # it for anything else, please
26
 
#                       scrobbler-helper -P pia -V 1.0 "$title" "$artist" "$album" "" "" "" "$((songDuration/1000))" &
27
 
#               fi
28
 
#               ;;
29
 
 
30
 
        *)
31
 
                if [ "$pRet" -ne 1 ]; then
32
 
                        echo "naughty.notify({title = \"pianobar\", text = \"$1 failed: $pRetStr\"})" | awesome-client -
33
 
                elif [ "$wRet" -ne 1 ]; then
34
 
                        echo "naughty.notify({title = \"pianobar\", text = \"$1 failed: Network error: $wRetStr\"})" | awesome-client -
35
 
                fi
36
 
                ;;
37
 
esac
38