/
sc-ripflip.sh
executable file
·71 lines (54 loc) · 2.02 KB
/
sc-ripflip.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
#!/bin/bash
##################################################
## http://github.com/dlnetworks/sc-ripflip ##
##################################################
## aggravates rippers by changing the title as ##
## many rippers write new files on title change ##
##################################################
#########################
## start configuration ##
#########################
## DNAS version (1 or 2)
scv="2"
## stream id (DNAS V2 only)
sid="1"
## DNAS password
passwd="dnas-admin-pass"
## hostname or ip address
host="stream.domain.com"
## enter port (if you dont have a port use port="80"
port="8000"
## what to change the title to
title="station name or promo text or any text"
## seconds to wait before changing back
waittime="1"
## seconds to sleep before repeating
sleeptime="30"
##############################################
## end configuration # do not edit the rest ##
##############################################
sc1url="http://$host:$port"
sc2url="http://$host:$port"
tmptitle="$(echo "$title" | sed 's/ /%20/g')";
while true
do
if [ "$scv" = "1" ]
then
sc1current="$(curl -s -A "$agent" "$sc1url"/7.html | cut -d',' -f 7- | cut -d'<' -f -1)";
sc1string="$(echo "$sc1current" | sed 's/ /%20/g')";
curl -s -A 'Mozilla/sc-ripflip' "$sc1url/admin.cgi?mode=updinfo&song=$tmptitle&pass=$passwd";
echo "Title set to: $title"
sleep "$waittime"
curl -s -A 'Mozilla/sc-ripflip' "$sc1url/admin.cgi?mode=updinfo&song=$sc1string&pass=$passwd";
echo "Title returned to: $sc1current"
else
sc2current="$(curl -s -A "$agent" "$sc2url"/currentsong?sid=$sid | cut -d',' -f 7- | cut -d'<' -f -1)";
sc2string="$(echo "$sc2current" | sed 's/ /%20/g')";
curl -s -A 'Mozilla/sc-ripflip' "$sc2url/admin.cgi?sid=$sid&mode=updinfo&song=$tmptitle&pass=$passwd";
echo "Title set to: $title"
sleep "$waittime"
curl -s -A 'Mozilla/sc-ripflip' "$sc1url/admin.cgi?sid=$sid&mode=updinfo&song=$sc2string&pass=$passwd";
echo "Title returned to: $sc2current"
fi
sleep "$sleeptime"
done