[mythtv-users] Attached perl script for generating half-hourly
guide data
Joshua King
jkingkard-hotmail at yahoo.com.au
Fri Nov 19 10:53:06 UTC 2004
There's been some calling for half-hour blank guide data in a couple of
threads now. If anyone wants to use this (reason: it made a good quick
programming exercise) go for it, below is the complete documentation you'll
get for it.
Requirements ---
This is a Perl script so you'll need Perl installed (if you haven't used a
grabber before you might need to install) Perl 5.8 or later please (that's
what I used).
Access to the mysql database for mythtv
Access to mythfilldatabase via the command line.
Instructions ---
Save the script to a file (I recommend calling it halfhour.pl but it's up to
you).
Change to its folder.
Create a list of the channels you have in MythTV -- you need the XMLTV ids.
You can get these from MySQL with the following command:
mysql -u mythtv -p mythconverg -b -e "select distinct xmltvid as '#xmltvid'
from channel;" > channels.conf
You will be asked for the password, usually this is 'mythtv'. The file
channels.conf now contains your list of channels. You need this when you run
the halfhour.pl script.
Make the script executable:
chmod +x halfhour.pl
Run the script, saving its output to a file.
./halfhour.pl channels.conf > tvguide.xml
Now find out the ID for your video source in the MySQL database. This
command lists the ids you have:
mysql -u mythtv -p mythconverg -b -e "select sourceid from videosource;"
Again enter the password.
Now you have all of the information for mythfilldatabase.
We're going to use the import from file feature of mythfilldatabase. It
accepts up to ten days of data at a time for one video source at a time.
A command which will import all of your data -- assuming your video source
is number 1 is:
Mythfilldatabase --file 1 -1 tvguide.xml
The first number needs to be replaced by your video source id.
Now refresh MythWeb and see what you get.
Tips ---
You could bundle this up into a shell script and have mythbackend run it for
you.
You can change the block size by changing the $INTERVAL = line in the script
(it's set to half an hour).
You can insert more than one day by putting the number of days after
channels.conf, as in:
./halfhour.pl channels.conf 7
If you only want block data for a certain video source, change the select
statement for the config file to:
select distinct xmltvid as '#xmltvid' from channel where sourceid = ?;
Replacing ? with the source number.
-------
Hope this helps someone (and before you ask, consider it in the public
domain).
Joshua King
-------------- next part --------------
A non-text attachment was scrubbed...
Name: halfhour.pl
Type: application/octet-stream
Size: 2519 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20041119/f9ac595a/halfhour.obj
More information about the mythtv-users
mailing list