Bug#526735: Acknowledgement (mplayer: 'dumpstream' should be switchable (on/off) while a stream is being played)
axst at users.sourceforge.net
axst at users.sourceforge.net
Sun May 3 08:02:41 UTC 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
There seems to be a problem with the script. I include it again here.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Made with pgp4pine 1.76
iEYEARECAAYFAkn9T6QACgkQMiDYPOQNapFmKACffPDYCNXVcO3CWnzAD5bePSYG
U34AniwUS1gt68UlyL33lcPSeujwjdNI
=oWFP
-----END PGP SIGNATURE-----
-------------- next part --------------
#!/bin/sh
STRCMD="/home/axxel/bin/streamsCommands $@"
if
test "$TERM" = "xterm" -o "$TERM" = "rxvt"
then
$STRCMD
else
USER=guest
CHANNELS=$(echo "select count(*) from channel where device='Net'" | mysql -s -u "$USER" wireless)
OTHERTEXT=6
WINDOWY=$(add_mod $CHANNELS $OTHERTEXT 65535 3)
echo Need $CHANNELS + $OTHERTEXT = $WINDOWY lines.
/usr/local/bin/uxterm.fvwm2 -geometry 135x$WINDOWY -title "M Player stream radio" -e $STRCMD
fi
-------------- next part --------------
#!/bin/sh
STREAMURL=$1
STREAMNAME=$2
CHANNELID="command line"
PROTDIR=~/.mplayer.keep
PROTLINK=$PROTDIR/last_protocol.txt
PROTEXT=protocol.txt
TERMINAL=`tty | sed "s-/dev/--"`
BEEPURLLOOPF="330"
BEEPURLLOOPD="100m"
BEEPURLFOUNDF="660"
BEEPURLFOUNDD="150m"
BEEPTRYF="1780"
BEEPTRYD="200m"
BEEPERRF="110"
BEEPERRD="100m"
BEEPMSGF=$BEEPERRF
BEEPMSGD=$BEEPERRD
BEEPCONNF="220"
BEEPCONND="100m"
BEEPCACHEF="440"
BEEPCACHED="100m"
BEEPBUFFERF="880"
BEEPBUFFERD="100m"
#BEEPPLAYF="880"
#BEEPPLAYD="200m"
#BEEPRETRYF=$BEEPTRYF
#BEEPRETRYD=$BEEPTRYD
BEEPRETRYF="55"
BEEPRETRYD="100m"
extractURL () {
grep "://" | grep -v -e "$STREAMURL" | sed -e 's-.*[ ="]\([a-z]*://\)-\1-' -e 's-[ "].*--' -e 's/%0D//g'
}
checkContent () {
while
read PROTOCOLLINE
do
echo $PROTOCOLLINE
case $PROTOCOLLINE in
(*o\ header*)
# "shoutcast"
return 1
;;
(*audio/mpeg* | *Ref1=* | *Reference]*)
return 1
;;
esac
done
return 0
}
removePort80 () {
echo $1 | sed -e 's-:80/-/-'
}
#cleanURL () {
# removePort80 $1 | sed -e 's-[:cntrl:]--' -e 's-[:space:]*$--' -e 's-^[:space:]*--'
#}
getStreamURL () {
while
echo "$STREAMURL" | grep -q "http://"
do
UNCUTURL="$STREAMURL"
TRYINGURL=$(removePort80 "$STREAMURL")
signalgen -t $BEEPURLLOOPD sine $BEEPURLLOOPF &
echo "Trying $TRYINGURL"
if
test "$TRYINGURL" != "$UNCUTURL"
then
echo " (instead of $UNCUTURL)"
fi
STREAMURL=$(wget "$TRYINGURL" -O - 2>&1 | checkContent | extractURL)
# echo -n "=== W Get: "
# STREAMURL=$(wget $STREAMURL -O - 2>&1)
# echo $STREAMURL
#
# echo -n "=== Checking content: "
# STREAMURL=$(echo $STREAMURL | checkContent)
# echo $STREAMURL
#
# echo -n "=== Extracting URL: "
# STREAMURL=$(echo $STREAMURL | extractURL)
# echo $STREAMURL
#echo "-> $(cleanURL $STREAMURL)"
#echo " from $(cleanURL $TRYINGURL)"
# if
# test "$(cleanURL $STREAMURL)" = "$(cleanURL $TRYINGURL)"
# then
# echo "* Looped."
# STREAMURL=
# fi
done
if
test -z "$STREAMURL"
then
echo "* HTTP stream"
STREAMURL="$TRYINGURL"
fi
signalgen -t $BEEPURLFOUNDD sine $BEEPURLFOUNDF
echo "--- Found:"
echo "$STREAMURL"
#STREAMURL=$(echo "$STREAMURL" | sed -e "s/\(.*\)$/\1 /")
}
chooser ()
{
USER=guest
echo "select channel_id as Id, station.name as Station, channel.remark as Channel from channel left join station on channel.station=station.skey where device='Net' order by station, Channel" \
| mysql -v -v -v -u "$USER" wireless
read -p "Channel ID: " CHANNELID
STREAMURL=$(echo "select setting from channel where channel_id=$CHANNELID" | mysql -s -u "$USER" wireless)
STREAMNAME=$(echo "select station.name from channel left join station on channel.station=station.skey where channel_id=$CHANNELID" | mysql -s -u "$USER" wireless | sed -e "s/^[ ]*/\"/" -e "s/[ ]*$/\"/")
}
protocol ()
{
if
test -w $PROTFILE
then
echo "$(date +%H.%M.%S): $PROTOCOLLINE" >>$PROTFILE
fi
}
setNecho ()
{
echo ">>> $(date +%H.%M.%S): $NEWTITLE <<<"
/usr/local/bin/settitle "$NEWTITLE"
}
setit ()
{
if
test -z "$STREAMMESSAGE"
then
NEWTITLE="$STREAMNAME [started at $STARTTIME${RETRYREMARK}]"
else
NEWTITLE="$STREAMNAME: $STREAMMESSAGE [started at $STARTTIME${RETRYREMARK}]"
fi
setNecho
}
keepsettingtitle ()
{
while
read PROTOCOLLINE
do
echo $PROTOCOLLINE
case $PROTOCOLLINE in
(*error* | *Error*)
signalgen -t $BEEPERRD sine $BEEPERRF &
STREAMMESSAGE="error: $(echo $PROTOCOLLINE | sed -e "s/^.*r:://")"
setit
protocol
;;
(*Server\ returned*)
signalgen -t $BEEPMSGD sine $BEEPMSGF &
STREAMMESSAGE="message: $(echo $PROTOCOLLINE | sed -e "s/^.*d //")"
setit
protocol
;;
(Playing\ * | Connecting* | Connected*)
signalgen -t $BEEPCONND sine $BEEPCONNF &
STREAMMESSAGE=$(echo $PROTOCOLLINE | sed -e "s/[ \.]*$//")
setit
protocol
;;
(Cache\ size\ set\ to\ *)
signalgen -t $BEEPCACHED sine $BEEPCACHEF &
STREAMMESSAGE=caching
setit
;;
(Cache\ fill*)
signalgen -t $BEEPBUFFERD sine $BEEPBUFFERF &
STREAMMESSAGE=buffering
setit
;;
(Starting\ playback*)
#signalgen -t $BEEPPLAYD sine $BEEPPLAYF &
STREAMMESSAGE=$CURRENTPROGRAMME
setit
;;
(name:\ *)
STREAMNAME=$(echo $PROTOCOLLINE | sed "s/^[ ]*name: //" | sed "s/^\"\(.*\)\"$/\1/")
STREAMMESSAGE=
setit
protocol
;;
(ICY*)
CURRENTPROGRAMME=$(echo $PROTOCOLLINE | sed "s/^.*e='//" | sed "s/';.*$//" )
STREAMMESSAGE=$CURRENTPROGRAMME
setit
protocol
;;
(Name\ :* | Genre\ :* | Website:* | Clip\ info:* | author:* | copyright:* | comments:* | Exit* | *URL* | *file\ format*)
protocol
;;
esac
done
}
if
test -z "$STREAMURL"
then
chooser
else
STREAMSOURCE="command line"
fi
if
test -e $PROTDIR -a -w $PROTDIR
then
find $PROTDIR -maxdepth 1 -type f -mtime +10 -exec rm {} \;
PROTSTART=$(date +%Y-%m-%d_%H.%M.%S)
PROTFILE=$PROTDIR/$PROTSTART.$PROTEXT
echo "Started: $PROTSTART" >$PROTFILE
ln -fs $PROTFILE $PROTLINK
fi
STARTTIME="$(date +%H.%M)"
RETRY=0
RETRYREMARK=""
setit
PROTOCOLLINE="$STREAMNAME: $STREAMURL ($CHANNELID)"
protocol
if
test -z "$STREAMNAME"
then
STREAMNAME=$STREAMURL
fi
getStreamURL
PROTOCOLLINE=$STREAMURL
protocol
signalgen -t $BEEPTRYD sine $BEEPTRYF
while
CURRENTPROGRAMME=
# original:
#mplayer -prefer-ipv4 -quiet -af volnorm=1:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
# ideas to prevent garbled audio (32000 worked best):
#mplayer -prefer-ipv4 -quiet -bandwidth 16 -af volnorm=2:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
#mplayer -prefer-ipv4 -quiet -bandwidth 32000 -af volnorm=2:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
#mplayer -prefer-ipv4 -quiet -bandwidth 64000 -af volnorm=2:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
#mplayer -prefer-ipv4 -quiet -bandwidth 256000 -af volnorm=2:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
#mplayer -prefer-ipv4 -quiet -bandwidth 1000000 -af volnorm=2:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
# trying codecs that are better suited to streaming:
mplayer -prefer-ipv4 -quiet -ac racook,ffmp3, -af volnorm=2:0.25 $STREAMURL $PARAMETERS 2>&1 | keepsettingtitle
do
signalgen -t $BEEPRETRYD sine $BEEPRETRYF &
let RETRY++
RETRYREMARK="; retry #$RETRY"
protocol
PROTOCOLLINE="retry #$RETRY --------------------------------------------------------"
protocol
done
PROTOCOLLINE="Ended."
protocol
echo Bye.
More information about the pkg-multimedia-maintainers
mailing list