From 6767d779e6eda723f9bcb88fbf3c0f33d923c9b5 Mon Sep 17 00:00:00 2001 From: short <> Date: Mon, 19 Sep 2005 00:07:59 +0000 Subject: [PATCH 1/1] +'http://di.fm/' player. --- bin/engine-di.fm | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 bin/engine-di.fm diff --git a/bin/engine-di.fm b/bin/engine-di.fm new file mode 100755 index 0000000..f377df0 --- /dev/null +++ b/bin/engine-di.fm @@ -0,0 +1,45 @@ +#! /bin/bash +# +# $Id$ + + +if [ "$1" = "build" ];then + old="`find -maxdepth 1 -name "di.fm-*" -type l`" + if [ -z "$old" ];then echo >&2 "No existing symlinks found.";exit 1;fi + newdashed="`wget -q -O - http://di.fm/|tr ' ' '\n' \ + |perl -n -e 's/^.*"([^"]*[.](?:pls|asx))".*$/$1/ and print;' \ + |grep -v '^/aacplus/' \ + |tr / -`" + if [ -z "$newdashed" ];then echo >&2 "Failed to download the new listing found.";exit 1;fi + TARGET="engine-di.fm" + if [ ! -x "$TARGET" ];then echo >&2 "Target engine $TARGET not found.";exit 1;fi + rm -f $old + PREFIX="di.fm" + for pathdashed in $newdashed;do + ln -s "$TARGET" "$PREFIX$pathdashed" + done + echo OK + exit 0 +fi + +set -ex +pathslashed="`basename "$0"|sed 's/^di[.]fm//'|tr - /`" +#MEDIA=mp3 +MEDIA=aacplus +if false;then + stream="`lynx -source http://di.fm${pathslashed}|sed -n 's/^File1=//p'|tr -d '\r'`" + exec mplayer -cache 128 "$stream" + exit 1 +else + streamlist="`lynx -source http://di.fm${pathslashed}|sed -n \ + -e 's/^File[0-9]*=//p' \ + -e 's#^.*"\(mms://[^"]*\)".*$#\1#p' \ + |tr -d '\r'`" + for stream in $streamlist;do + # Using "set -e" here: + # mplayer rc 0 on failure to read the stream + # mplayer rc 0 on 'q' + # mplayer rc 1 on ctrl-c + mplayer -cache 128 "$stream" + done +fi -- 1.8.3.1