View Single Post
Old 02-18-2012, 10:37 PM   #27
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
Quote:
Originally Posted by Xiaopangzi View Post
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 ..."
I'm not really sure how to use this. How do I make an HTML page that can launch music files? What would that look like? Many thanks.

Last edited by sjheiss; 02-18-2012 at 10:39 PM.
sjheiss is offline   Reply With Quote