-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclt.sh
executable file
·47 lines (40 loc) · 1.11 KB
/
clt.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
#!/bin/bash
function usage {
cat << EOF
USAGE:
"id": get current track
"dj": get current dj
"y": search last shown track on youtube
EOF
}
function gettrack {
TRACK=$(curl -s http://www.clubtime.fm/tracklist | grep -A1 '<div style="width:345px;float:left; margin-top:11px; overflow:hidden">' | tail -1 | sed -e 's/^.*">\([^<>]*\).*$/\1/g')
echo $TRACK
}
function getdeejay {
DJ="$(curl -s http://www.clubtime.fm/showplan | grep -A1 '<div id="onAir" style="width:420px;overflow:hidden;">' | tail -1)"
if [ $(echo $DJ | grep -c Playlist) -eq 1 ] ; then
DJ=$(echo $DJ | sed -e 's/^.*">\([^<]*\).*$/\1/g')
else
DJ=$(echo $DJ | sed -e 's/^.*FF0">\([^<]*\).*">\([^<]*\).*$/\1 \2/')
fi
echo $DJ
}
function searchyt {
if [ "x$TRACK" = "x" ]; then
echo "no track shown so far, searching for current track:"
gettrack
fi
QUERY=$(echo $TRACK | sed -e 's/\ /+/g')
firefox -new-tab "https://www.youtube.com/results?search_query=$QUERY"
}
cvlc -v http://aac-hd.stream.tb-group.fm/clt > /dev/null &
while true ; do
read command
case $command in
id ) gettrack ;;
dj ) getdeejay ;;
y ) searchyt ;;
* ) usage ;;
esac
done