-
Notifications
You must be signed in to change notification settings - Fork 2
/
rpd-update-conf.sh
executable file
·42 lines (33 loc) · 1.2 KB
/
rpd-update-conf.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
#! /bin/sh
### Douban details
DOUBAN_EMAIL='[email protected]'
DOUBAN_PASS='doubantucao'
### Jing details
JING_EMAIL=''
JING_PASS=''
douban_res="`curl -sG -d"email=$DOUBAN_EMAIL" -d"password=$DOUBAN_PASS" -d"app_name=radio_desktop_win" -d"version=100" "http://www.douban.com/j/app/login" | python -mjson.tool`"
echo "[Radio]
channel = 0
[DoubanFM]"
echo "$douban_res" | grep user_id | awk '{print $2}' | awk -F'"' '{print "uid = "$2}'
echo "$douban_res" | grep user_name | awk '{print $2}' | awk -F'"' '{print "uname = "$2}'
echo "$douban_res" | grep token | awk '{print $2}' | awk -F'"' '{print "token = "$2}'
echo "$douban_res" | grep expire | awk '{print $2}' | awk -F'"' '{print "expire = "$2}'
echo "kbps ="
echo "
[JingFM]"
jing_res="`curl -si -d"email=$JING_EMAIL" -d"pwd=$JING_PASS" 'http://jing.fm/api/v1/sessions/create'`"
echo "$jing_res" | tail -n 1 | python -mjson.tool | grep -m1 uid | awk '{print "uid = "$2}'
echo "$jing_res" | grep "Jing-A-Token-Header" | awk '{print "atoken = "$2}'
echo "$jing_res" | grep "Jing-R-Token-Header" | awk '{print "rtoken = "$2}'
echo "
[Output]
driver = alsa
device = default
[Server]
address = 0.0.0.0
port = 10098
[Local]
music_dir = ~/Music
download_lyrics = 0
"