6 echo >&2 "FIXME: http_proxy"
10 if [ "$1" = "build" ];then
11 old="`find -maxdepth 1 '(' -name "di.fm-*" -o -name "sky.fm-*" ')' -type l`"
12 if [ -z "$old" ];then echo >&2 "No existing symlinks found.";exit 1;fi
13 for site in di.fm sky.fm;do
14 newdashed="`wget -q -O - http://$site/|tr ' ' '\n' \
16 s{^.*"(?:http://www.'$site')?([^":]*(?<!_low)[.](?:pls|asx))".*$}{$1} or next;
17 m{^/aacplus/} and next;
22 if [ -z "$newdashed" ];then echo >&2 "Failed to download the new listing found.";exit 1;fi
24 if [ ! -x "$TARGET" ];then echo >&2 "Target engine $TARGET not found.";exit 1;fi
28 for pathdashed in $newdashed;do
29 test -L "$PREFIX$pathdashed" && continue
30 ln -s "$TARGET" "$PREFIX$pathdashed"
38 pathslashed="`basename "$0"|tr - /`"
40 stream="`lynx -source http://di.fm${pathslashed}|sed -n 's/^File1=//p'|tr -d '\r'`"
41 exec mplayer -ao oss:/dev/dsp -cache 128 "$stream" "$@"
45 streamlist="`lynx -source http://${pathslashed}|sed -n \
46 -e 's/^File[0-9]*=//p' \
47 -e 's#^.*"\(mms://[^"]*\)".*$#\1#p' \
49 for stream in $streamlist;do
50 # Using "set -e" here:
51 # mplayer rc 0 on failure to read the stream
53 # mplayer rc 1 on ctrl-c
54 ip="` echo "$stream"|sed -n 's#^http://\([^:/]*\).*$#\1#p'`"
56 port="`echo "$stream"|sed -n 's#^http://[^:/]*:\([0-9][0-9]*\).*$#\1#p'`"
58 echo >&2 "Checking $stream -> {$ip}:{$port} ..."
59 if ! nc -w 2 "$ip" "$port";then
60 echo >&2 "TIMEOUT: $stream"
64 #mplayer -ao alsa:device=hw=0 -cache 512 "$stream" "$@"
65 mplayer -cache 512 "$stream" "$@"