#!/bin/sh # usage: splay.sh [ -d ] [ URL ] # splay.sh [ -s ] [ URL ] [ file ] get_uri () { case "$1" in *mp3|*MP3|*ogg|*OGG) URI=$* ;; *m3u) URI="-playlist $*" ;; mms*|rtsp*) URI=$* ;; *fmhanako*) URI=`wget -O - $* | sed -n 's/^.*\(mms:[^"]*\).*$/\1/p' | sed -n '1p'` ;; *asx*|*push1) URI=`wget -O - $* | sed -n '{s/^.*\(mms:[^"]*\).*$/\1/p; s/^.*\(http:[^"]*\).*$/\1/p;}' | sed -n '$p'` ;; *ram|*rm) URI=`wget -O - $* | sed -n 's/^.*\(rtsp:.*rm\).*$/\1/p'` ;; *) URI=$* ;; esac } case "$1" in -d) shift wget -O - $* ;; -s) # save file shift get_uri $1 mplayer $URI -dumpstream -dumpfile $2 ;; *) # play stream get_uri $* mplayer -novideo $URI ;; esac echo $URI exit 0