[mythtv-users] MythFrontend on the Nokia n800
Mark H
mrhegstrom at gmail.com
Tue Apr 29 19:26:53 UTC 2008
I created a script called stream.sh that I use all of the time. I ssh into
my knoppmythbox and run the script, which streams either a recording, a
video, a dvd or even live TV. I use a Verizon Samsung PDA and run TCPMP
video player and point it to my box. Works wonderfully, and can use with
any computer running vlc or mplayer, etc. I'm not a php programmer, but I
would like to one day figure out how to run the script from mythweb.
Note: On Debian, if apt-get remove vlc, you must also do apt-get remove vlc
vlc-nox AND libvlc0, libvlc0 will not autoremove and will cause problems!
steam.sh: (change your local IP on line 119, pwd and IP on line 148 and port
forward 8001 to your box)
#!/bin/bash
clear
VSPEED=0
ASPEED=0
VSIZE=0
VSIZE2=0
FPS=0
CHAPTER=0
## CHECK FOR PRESETS, ADD YOUR OWN HERE
echo "Use Presets for work or ppc (work,ppc,n)?"
read vPRESET
if [ $vPRESET == "work" ]; then
VSPEED='300'
ASPEED='48'
VSIZE='75'
VSIZE2='.75'
FPS='25'
elif [ $vPRESET == "ppc" ]; then
VSPEED='128'
ASPEED='32'
VSIZE='25'
VSIZE2='.25'
FPS='15'
fi
## PROMPT IF NO PRESET SELECTED
if [ $VSPEED == "0" ]; then
echo "Video Speed (500,300,256,192,128)?"
read VSPEED
echo
fi
if [ $ASPEED == "0" ]; then
echo "Audio Speed (128,96,64,48,32)?"
read ASPEED
echo
fi
if [ $VSIZE2 == "0" ]; then
echo "Video Size% (100,75,50,25)?"
read VSIZE
if [ $VSIZE == "100" ]; then
VSIZE2='1.0'
elif [ $VSIZE == "75" ]; then
VSIZE2='.75'
elif [ $VSIZE == "50" ]; then
VSIZE2='.50'
elif [ $VSIZE == "25" ]; then
VSIZE2='.25'
fi
fi
echo
if [ $FPS == "0" ]; then
echo "FPS (25,20,15,10,5)?"
read FPS
echo
fi
## SELECT STREAM MODE
echo "1. Stream Rec."
echo "2. Stream Live."
echo "3. Stream Video."
echo "4. Stream DVD."
read vMODE
## BEGIN STREAM RECORDED SCRIPT##
if [ $vMODE == "1" ]; then
echo
echo "Recorded Programs:"
echo
ls /myth/pretty
echo
echo "Which File? (d)-view filenames for duplicate titles"
read VIDEO
if [ $VIDEO == "d" ]; then
ls -All /myth/pretty
echo "Which filename?"
read VIDEOFILE
fi
echo "File: "$VIDEO $VIDEOFILE
if [ $VIDEO == "d" ]; then
vlc -I http --http-host=:8002 --sout-transcode-fps=$FPS
--sout-transcode-deinterlace /myth/tv/$VIDEOFILE
":sout=#transcode{vcodec=DIV3,acodec=mpga,vb=$VSPEED,ab=$ASPEED,scale=$SIZE2}:std{access=http{user='',pwd='',mime=video/x-ms-asf},mux=asf,url=:8001}"
exit 1
fi
vlc -I http --http-host=:8002 --sout-transcode-fps=$FPS
--sout-transcode-deinterlace /myth/pretty/$VIDEO
":sout=#transcode{vcodec=DIV3,acodec=mpga,vb=$VSPEED,ab=$ASPEED,scale=$SIZE2}:std{access=http{user='',pwd='',mime=video/x-ms-asf},mux=asf,url=:8001}"
exit 1
### END OF RECORDED SCRIPT ###
## BEGIN LIVE SCRIPT ##
elif [ $vMODE == "2" ]; then
MYTHWEB_STATUS=status
### Taken from parseTunerStatus of mythstreamtvLive scripts
MYTH_WEB_STATUS=http://192.168.0.1/mythweb/status
# Figure out if tuner has a recording scheduled and when - add
message to ddl
FindNextSchedule()
{
PARM=${1}
DEVICE=${2}
TUNER=`echo ${PARM} | awk '{ print $1, $2}'`
ScheduleBegin=`grep -n "The next 10 shows" ${STATUS} | cut -f1 -d:`
NEXTTIME=`tail -n +${ScheduleBegin} ${STATUS} | \
grep " - ${TUNER} - " | \
head -1 | cut -f2 -d\> | cut -f1 -d- `
if [ -z "${NEXTTIME}" ]
then
echo "\"$LINE - No scheduled recordings."
else
echo "\"$LINE - Next recording at ${NEXTTIME}."
fi
}
#----------------------------------------------------------------------------
# Main Routine
#----------------------------------------------------------------------------
cd /tmp
# get the HTML status page
wget --http-user=mythtv --http-passwd=youpassword
http://192.168.0.1/mythweb/status 2> /tmp/wget.error
STATUS=/tmp/status
# grab local Encoder status lines
EncoderStatusBegin=`grep -n "Encoder status" ${STATUS} | cut -f1 -d:`
tail -n +${EncoderStatusBegin} ${STATUS} | head -5 | \
egrep "^[ ]*Encoder.*local" > /tmp/tunerstatus
# Clean up the the status text
cat /tmp/tunerstatus | awk '/not recording/ {print $1, $2, "- Free"}
/is recording/ {print $1, $2, "- Recording"}' >
/tmp/tnrsts.terse
# Now loop through each tuner and create ddl entry
while read LINE
do
TUNER_NUM=`echo ${LINE} | awk '{ print $2}'`
DEVICE="/dev/video$((${TUNER_NUM}-1))"
if [ ! -z "`echo $LINE | grep Recording`" ]
then
# if recording - just ues 'cleaned up' terse text
echo "<option value=\"${DEVICE}\">$LINE</option>"
else
# if not recording, figure out next scheduled recording for tuner
FindNextSchedule "${LINE}" "${DEVICE}"
fi
done < /tmp/tnrsts.terse
# cleanup
rm -f /tmptnrsts.terse /tmp/tunerstatus /tmp/status
## MY SCRIPT STARTS HERE
echo
echo "Use CaptureCard 1(Myth) or 2(Reg)?"
read DEVICE
if [ $DEVICE == "1" ]; then
DEV='/dev/video0'
echo "Channel?"
read CHAN
echo "Changing to Channel: "$CHAN
change_channel.csh $CHAN
elif [ $DEVICE == "2" ]; then
DEV='/dev/video1'
fi
echo
xterm /home/mythtv/stream_channel_prompt.sh -geometry 24x10+10+10 &
echo "Starting VLC..."
vlc -I http --http-host=8002 pvr:$DEV --sout-transcode-fps=$FPS
--sout="#transcode{vcodec=DIV3,vb=$VSPEED,scale=$VSIZE2,acodec=mpga,ab=$ASPEED}:std{access=http{user='',pwd='',mime=video/x-ms-asf},mux=asf,url=:8001}"
exit 1
## END STREAM LIVE TV ##
## BEGIN STREAM VIDEO SCRIPT ##
elif [ $vMODE == "3" ]; then
echo
echo "Recorded Programs:"
echo
ls /myth/video
echo
echo "Which File?"
read VIDEO
echo "Starting VLC..."
vlc -I http --http-host=:8002 --sout-transcode-fps=$FPS
--sout-transcode-deinterlace /myth/video/$VIDEO
":sout=#transcode{vcodec=DIV3,acodec=mpga,vb=$VSPEED,ab=$ASPEED,scale=$SIZE2}:std{access=http{user='',pwd='',mime=video/x-ms-asf},mux=asf,url=:8001}"
elif [ $vMODE == "4" ]; then
echo
echo "Which Chapter?"
read CHAPTER
echo "Starting VLC..."
vlc -vvv --color dvdsimple:/dev/dvd at 1:$CHAPTER --sout udp://
192.168.0.255 --ttl 12 --sout-all
fi
This script also calls a small window that makes it easy to change channels
when viewing live TV:
stream_channel_prompt.sh:
#!/bin/bash
NEWCHAN=0
while [ $NEWCHAN -lt 9999 ]; do
clear
echo "Change to Channel?"
read NEWCHAN
change_channel.csh $NEWCHAN
done
Hope anyone else can use this. You may need to tweak more to fit your
installation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080429/151d06c2/attachment.htm
More information about the mythtv-users
mailing list