-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventcommand.sh
80 lines (72 loc) · 2.62 KB
/
eventcommand.sh
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
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
pwd=$(pwd)
fold="$HOME/.config/pianobar"
stl="/var/www/station.txt"
ctlf="$fold/ctl"
nowplaying="$fold/nowplaying"
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\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|songDuration\|songPlayed\|coverArt\|stationCount\|station[0-9]\+\)=' /dev/stdin)
case "$1" in
songstart)
echo -e "$artist \n$title \n$stationName \n$rating \n$coverArt \n$album \n$songDuration \n$id" > /var/www/songinfo.txt
echo -e "$title \n$artist \n$album \n$stationName \n$songStationName \n$pRet \n$pRetStr \n$wRet \n$wRetStr \n$songDuration \n$songPlayed \n$rating \n$coverArt \n$stationCount" > $fold/info.txt
;;
songlove)
echo -e "$artist \n$title \n$stationName \n$rating \n$coverArt \n$album" > "$nowplaying"
;;
songban)
echo -e "" > "$nowplaying"
;;
usergetstations)
if [[ $stationCount -gt 0 ]]; then
rm -f "$stl"
for stnum in $(seq 0 $(($stationCount-1))); do
echo "$stnum) "$(eval "echo \$station$stnum") >> "$stl"
done
fi
;;
stationcreate)
if [[ $stationCount -gt 0 ]]; then
rm -f "$stl"
for stnum in $(seq 0 $(($stationCount-1))); do
echo "$stnum) "$(eval "echo \$station$stnum") >> "$stl"
done
fi
;;
stationaddgenre)
if [[ $stationCount -gt 0 ]]; then
rm -f "$stl"
for stnum in $(seq 0 $(($stationCount-1))); do
echo "$stnum) "$(eval "echo \$station$stnum") >> "$stl"
done
fi
;;
songexplain)
if [[ $stationCount -gt 0 ]]; then
rm -f "$stl"
for stnum in $(seq 0 $(($stationCount-1))); do
echo "$stnum) "$(eval "echo \$station$stnum") >> "$stl"
done
fi
;;
stationaddshared)
if [[ $stationCount -gt 0 ]]; then
rm -f "$stl"
for stnum in $(seq 0 $(($stationCount-1))); do
echo "$stnum) "$(eval "echo \$station$stnum") >> "$stl"
done
fi
;;
stationdelete)
if [[ $stationCount -gt 0 ]]; then
rm -f "$stl"
for stnum in $(seq 0 $(($stationCount-1))); do
echo "$stnum) "$(eval "echo \$station$stnum") >> "$stl"
done
fi
echo -e "" > "$nowplaying"
;;
esac