Using shell scripts for tuning dvb-s

Status
Please reply by conversation.

dhubsith

Well-Known SatelliteGuys Member
Original poster
Nov 21, 2007
29
0
California
I have been using kplayer and kaffeine for watching dvb-s programming, but recently I switched to a simpler system using mplayer, dvbstream, and shell scripts. I have a shell script for watching, and another for recording, for each channel. Icons on the desktop point to the folders containing the watch and record shell scripts, which are arranged in folders by satellite. Clicking on a shell script icon will tune in that channel.

A shell script for watching a channel looks like this:

#!/bin/sh

mplayer dvb://PBS-SD04-World -dvbin timeout=10 -ao alsa -vo xv -fs -vf scale=720:540,crop=720:448:0:48,pp=lb

And a shell script for recording a channel looks like this:

#!/bin/sh

dvbstream -f 12180 -p v -s 30000 -v 225 -a 228 -o | tee /mnt/sda2/$(date +%Y%m%d%H%M%S).ts | mplayer -ao alsa -vo xv -fs -vf scale=720:540,crop=720:448:0:48,pp=lb -

Since I didn't want to have to manually code shell scripts for watching and recording 200+ channels on 14 satellites, I wrote shell scripts to generate the watch and record scripts from configuration data produced by the scan utility.

Here is the shell script to generate the "watch" scripts:

#!/bin/sh

channelname="`cat < /mnt/a1/etc/Franz/dvb/channels/$1`"
for i in $channelname
do
name=`echo $i|awk -F: '{print $1}'`
echo -e "#!/bin/sh\n\nmplayer dvb://$name -dvbin timeout=10 -ao alsa -vo xv -fs -vf scale=720:540,crop=720:448:0:48,pp=lb" | tee /mnt/a1/etc/Franz/dvb/dvbwatch/$1/$name.sh
done

And here is the shell script to generate the "record" scripts:

#!/bin/sh

channelname="`cat < /mnt/a1/etc/Franz/dvb/channels/$1`"
for i in $channelname
do
name=`echo $i|awk -F: '{print $1}'`
freq=`echo $i|awk -F: '{print $2}'`
pole=`echo $i|awk -F: '{print $3}'`
symb=`echo $i|awk -F: '{print $5}'`
vpid=`echo $i|awk -F: '{print $6}'`
apid=`echo $i|awk -F: '{print $7}'`
echo -e "#!/bin/sh\n\ndvbstream -f $freq -p $pole -s $symb -v $vpid -a $apid -o | tee /mnt/sda2/\$(date +%Y%m%d%H%M%S).ts | mplayer -ao alsa -vo xv -fs -vf scale=720:540,crop=720:448:0:48,pp=lb -" | tee /mnt/a1/etc/Franz/dvb/dvbrecord/$1/$name.sh
done

I hope this will be useful.
 
Last edited:
Good thinking. Neat stuff. Have you tried any HD channels, and if so do you feel a script approach has advantages in decreasing the burden on the processor and other system components?
 
Good thinking. Neat stuff. Have you tried any HD channels, and if so do you feel a script approach has advantages in decreasing the burden on the processor and other system components?

I have tried PBS-HD, and actually watch it a lot. The script for that is slightly different, in that you don't have to do the crop and scale.

I don't think that scripts make much difference to system resources. If you have, say, kplayer, running, it will take up a bit of memory but all the cpu utilization will be mplayer and X.

One thing I forgot to mention, is that the script has to have execute permissions in order to open when you click on it. Something like this at the end of the generating script will do it:

find /mnt/a1/etc/Franz/dvb/dvbwatch/$1 -exec chmod a+x -c {} \;
 
Status
Please reply by conversation.

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

Who Read This Thread (Total Members: 1)

Top