[mythtvnz] Mhegepgsnoop Setup

David Moore dmoo1790 at ihug.co.nz
Thu Jun 21 01:15:19 BST 2012


On 20/06/12 20:41, Stephen Worthington wrote:
> On Wed, 20 Jun 2012 19:13:25 +1200, you wrote:
>
>> With all the recent talk about epg I thought I would give the
>> mhegepgsnoop grabber a go and see what I could get.
>>
>> Is there any documentation on how to get it running as I don't seem to
>> be having any luck.
>>
>> If I run the with the command line
>> /home/neil/mhegepgsnoop-0.3.6.py -m "-u<user>  -p<pw>" -d
>> /dev/dvb/adapter0/demux1 -o /home/neil/mheg.xml
>>
>> I get this in dmesg
>> cx8802_start_dma() Failed. Unsupported value in .mpeg (0x00000001)
>>
>> What am I doing wrong as I would like to give it a go.
>>
>> Neil
>
> mhegepgsnoop.py does not tune the DVB-T adapter.  I use dvbtune to do
> that.  This is the script I use to get the ChoiceTV EPG:
>
> #!/bin/bash
>
> # DVB-T multiplex frequency (kHz)
> DVB_T_FREQ=594000
>
> # Adapter number of DVB-T card.
> ADAPTER=2
>
> # Output file to store the xmltv EPG data.
> OUTPUT_FILE=/tmp/xmltv.xml
>
> # Temp directory name.
> TEMP_DIR=/tmp/mhegepgsnoop_jsw
>
> PWD=`pwd`
>
> if [ -e "$OUTPUT_FILE" ]&&  [ -f "$OUTPUT_FILE" ] ; then
>      rm "$OUTPUT_FILE"
> fi
>
> # Get the MHEG5 EPG data from the DVT-T multiplex.
> dvbtune -f $DVB_T_FREQ -qam 64 -gi 16 -cr 3_4 -bw 8 -tm 8 -m -c
> $ADAPTER 2>1>/dev/null&
> DVBTUNE_PID=$!
> sleep 1
> mhegepgsnoop_jsw.py -z -d /dev/dvb/adapter${ADAPTER}/demux0 -o
> $OUTPUT_FILE
> kill $DVBTUNE_PID>/dev/null
>
> # Extract the ChoiceTV channel data only.
> mkdir $TEMP_DIR
> cd $TEMP_DIR
> tv_split -o %channel.xml.not $OUTPUT_FILE
> mv choicetv.freeviewnz.tv.xml.not $OUTPUT_FILE
> rm *.not
>
> cd $PWD
> rmdir $TEMP_DIR
>
> Note that long lines may be wrapped by your newsreader (eg the dvbtune
> one).
>
> My mhegepgsnoop_jsw.py file is a slightly modified version of
> mhegepgsnoop.py 0.3.5 with the "mysql_args =" line changed to allow a
> valid login to my mythconverg database.  "mysql_args =-u root" does
> not work on my system.
>
> I run this from a cron job that does all my epg processing at 15:10
> using my third DVB-T tuner as I know that it will never be in use at
> that time.
>

Interestingly on my system, with an HVR2200 tuner, I never need to tune 
to get the EPG and I never have problems pulling the EPG from an active 
tuner. My system is powered off overnight too.

My cron job runs at 10 minutes past every hour. I do this because I have 
noticed that the MHEG EPG does get updated at odd times during the day. 
Mostly trivial changes to show descriptions I believe. My cron job runs 
as root so I don't need to be logged in to get the EPG.

I have a small wrapper script that checks to see if the EPG has changed 
before deciding to run mythfilldatabase or not:


#!/bin/bash
FILE_NAME="/home/dmoo1790/linuxdvb-0.1/xmltvaaa.xml"
LOG_FILE="/home/dmoo1790/linuxdvb-0.1/error2.log"

if [ -f $FILE_NAME ]; then
	mv $FILE_NAME "$FILE_NAME.old"
else
	touch "$FILE_NAME.old"
fi

/home/dmoo1790/linuxdvb-0.1/mhegepgsnoop-0.3.6.py -o $FILE_NAME -vu -d 
"/dev/dvb/adapter1/demux0" &> $LOG_FILE

if [ $? -eq 0 -a -f $FILE_NAME ]; then

	diff <(tail -n +2 $FILE_NAME) <(tail -n +2 "$FILE_NAME.old") &>> $LOG_FILE

	if [ $? -ne 0 ]; then
		mythfilldatabase --update --file --sourceid 1 --xmlfile $FILE_NAME &>> 
$LOG_FILE
	else
		echo "Files are identical. Not running mythfilldatabase." >> $LOG_FILE
	fi

fi


Stephen, my guess is that user root needs a password or even doesn't 
have rights to access the database on your system. I'll probably add an 
option to use the python bindings for database access in a future 
version. This simplifies the user/password thing so long as you run the 
script as a user with permission to read the correct config.xml (and 
mysql.txt?) file. On my system I have created links from my 
/home/dmoo1790/.mythtv/ directory to /home/mythtv/.mythtv/ to get the 
python bindings working.



More information about the mythtvnz mailing list