-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_di_radiotunes.bash
More file actions
26 lines (21 loc) · 851 Bytes
/
get_di_radiotunes.bash
File metadata and controls
26 lines (21 loc) · 851 Bytes
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
#!/bin/bash
# Copyright (c) 2014-2015 Fatih Bostancı <faopera@gmail.com>
# GPLv3
# credits: http://mpd.wikia.com/wiki/Hack:di.fm-playlists
function get_radiotunes() {
mkdir -p radiotunes && cd radiotunes
wget -q -O - http://listen.radiotunes.com/public1 | sed 's/},{/\n/g' | \
perl -n -e '/"key":"([^"]*)".*"playlist":"([^"]*)"/; print "$1\n"; system("wget -q -O - $2 | grep -E '^File' | cut -d= -f2 > radiotunes_$1.m3u")'
cd - &>/dev/null
}
function get_di_fm() {
mkdir -p di.fm && cd di.fm
wget -q -O - http://listen.di.fm/public1 | sed 's/},{/\n/g' | \
perl -n -e '/"key":"([^"]*)".*"playlist":"([^"]*)"/; print "$1\n"; system("wget -q -O - $2 | grep -E '^File' | cut -d= -f2 > di_$1.m3u")'
cd - &>/dev/null
}
case $1 in
--di) get_di_fm ;;
--sky|--radiotunes) get_radiotunes ;;
--all) get_di_fm && get_radiotunes ;;
esac