6 if [ "$1" = "build" ];then
7 old="`find -maxdepth 1 -name "di.fm-*" -type l`"
8 if [ -z "$old" ];then echo >&2 "No existing symlinks found.";exit 1;fi
9 newdashed="`wget -q -O - http://di.fm/|tr ' ' '\n' \
10 |perl -n -e 's/^.*"([^"]*[.](?:pls|asx))".*$/$1/ and print;' \
11 |grep -v '^/aacplus/' \
13 if [ -z "$newdashed" ];then echo >&2 "Failed to download the new listing found.";exit 1;fi
15 if [ ! -x "$TARGET" ];then echo >&2 "Target engine $TARGET not found.";exit 1;fi
18 for pathdashed in $newdashed;do
19 ln -s "$TARGET" "$PREFIX$pathdashed"
26 pathslashed="`basename "$0"|sed 's/^di[.]fm//'|tr - /`"
30 stream="`lynx -source http://di.fm${pathslashed}|sed -n 's/^File1=//p'|tr -d '\r'`"
31 exec mplayer -cache 128 "$stream"
34 streamlist="`lynx -source http://di.fm${pathslashed}|sed -n \
35 -e 's/^File[0-9]*=//p' \
36 -e 's#^.*"\(mms://[^"]*\)".*$#\1#p' \
38 for stream in $streamlist;do
39 # Using "set -e" here:
40 # mplayer rc 0 on failure to read the stream
42 # mplayer rc 1 on ctrl-c
43 mplayer -cache 128 "$stream"