[mythtv-users] mythfilldatabase --file options and manual updates

Jeff C myth at express.tc
Tue Apr 20 14:30:16 EDT 2004


Hi Everyone,

 

My local cableco is not currently part of Zap2It's listings, so I can not
simply pull them down from within myth.  Instead I had to write some scripts
to compile my listings. 

 

I found sources (cities & cablecos) that have the channels I need (I think I
get data from 7 cities).  I then ran tv_grab_na -configure for each city and
grabbed the channel lists, saying "no" to all the channels except those that
I need.  Then I made a directory with one config file for each city.

 

I have a script that iterates through the files and for each file, grabs
tomorrow's data for each city and stores it, then runs back through the data
and compiles it in to one master XML file.  The script looks like this:

 

#!/bin/sh

#

# wiv-get-daily.sh - A script to collect listing for WIV Cable, Provo, TCI,
BWI

#

# April 16, 2003 - Jeff Campbell - jac1d at hotmail.com

#

# The script works in two setps, first it collects channel data from all

# the relevant sources (cities/providers), and keeps it in individual files.

#

# The second step combines the list in to a complete XML file for MythTV.

#

# The script is dependent on the source files in the xmlsources directory

# that describe which channel data to collect from each providers in order

# to compile the complete listings for WIV Cable's service.

#

# This list was hand compiled by Jeff Campbell.

#

tomorrow='/home/mythtv/WIV-tomorrow.xml'

tenout='/home/mythtv/WIV-10out.xml'

xmlsources='/home/mythtv/provozap2it/xmlsources'

#

#

# Clean up any privous WIV-Provo.xml file

cat /dev/null > $tomorrow

cat /dev/null > $tenout

# Iterate through the sources and collect tomorrows to catch changes

for file in `ls $xmlsources`

do

        /usr/bin/tv_grab_na --config-file $xmlsources/$file --days 1
--offset 1 --output /tmp/$file.myth --release-check false

done

 

# Compile finished file

for curfile in `ls /tmp/*.myth`

do

        cat $curfile | sed s/W1\-10\ WKRN/C2wkrn.zap2it.com/ > $curfile.tmp

        mv $curfile.tmp $curfile

done

 

flag=0

for curfile in `ls /tmp/*.myth`

do

        totlen=`wc -l $curfile | awk '{print $1}'`

        if [ $flag -eq 0 ]

        then

                headlen=`expr $totlen - 1`

                head -$headlen $curfile > $tomorrow

                flag=1

        else

                taillen=`expr $totlen - 4`

                headlen=`expr $taillen - 1`

                tail -$taillen $curfile | head -$headlen >> $tomorrow

        fi

done

 

echo \</tv\> >> $tomorrow

 

# This is for getting the "next" day for the 10th day out, always

# Always keeping a new day rolling in.

#

# Iterate through the sources and collect day 10's listings

for file in `ls $xmlsources`

do

        /usr/bin/tv_grab_na --config-file $xmlsources/$file --days 1
--offset 9 --output /tmp/$file.10.myth --release-check false

done

 

# Compile finished file but fix the CBAND stuff first

for curfile in `ls /tmp/*.myth`

do

        cat $curfile | sed s/W1\-10\ WKRN/C2wkrn.zap2it.com/ > $curfile.tmp

        mv $curfile.tmp $curfile

done

 

flag=0

for curfile in `ls /tmp/*.myth`

do

        totlen=`wc -l $curfile | awk '{print $1}'`

        if [ $flag -eq 0 ]

        then

                headlen=`expr $totlen - 1`

                head -$headlen $curfile > $tenout

                flag=1

        else

                taillen=`expr $totlen - 4`

                headlen=`expr $taillen - 1`

                tail -$taillen $curfile | head -$headlen >> $tenout

        fi

done

echo \</tv\> >> $tenout

 

# Remove the temporary individual files

#rm /tmp/*.myth

#echo "Inserting data"

#/usr/bin/mythfilldatabase --no-delete --update --file 1 1 $tomorrow

#echo "DONE TOMORROW"

#/usr/bin/mythfilldatabase --no-delete --update --file 1 9 $tenout

#echo "Done 10 Out"

 

 

The problem I am having is that while my sources and data and compiling work
for the initial 14 day period, when I try and use this script to collect and
enter the data for tomorrow and 10 days out, it seems to munge something in
the DB and I get extended show times and missing days etc.  I am no sure if
its syntax on my end or what.

 

Is there anyone out there who is knowledgeable in mythfilldatabase that
could lend a hand?  I would really appreciate it.

 

-Jeff

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20040420/25757184/attachment.htm


More information about the mythtv-users mailing list