View Single Post
Old 03-22-2011, 05:20 PM   #8
Xiaopangzi
Enthusiast
Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.
 
Posts: 29
Karma: 16912
Join Date: Mar 2011
Device: kindle k3, prs-t2
Smile

The following works to lauch mplayer streaming some URL by clicking it (from a list of such URLs in an .html or .txt file). It could use some improving, like including the useful part of mplayer's output (but no cache fill... etc).

Code:
#!/bin/sh

# This is file /mnt/us/www/cgi-bin/mplay
# call using (replace host/stream/Station):
# <a href="http://localhost/cgi-bin/mplay?http://host/stream">Station</a>

echo 'Content-type: text/plain'
echo ''

INSTALLDIR=/mnt/us/mplayer
NICENESS="-10"
FIFO=/tmp/mplayer.fifo
MPLAYER="nice -n$NICENESS $INSTALLDIR/mplayer -ao alsa -slave -quiet -input file=$FIFO"

test -z `pidof mplayer` || killall mplayer >/dev/null 2>&1
test -e $FIFO || mkfifo $FIFO

($MPLAYER -playlist "$1" >/dev/null 2>&1) &

echo "Now playing $1 ..."
Xiaopangzi is offline   Reply With Quote