[mythtv-users] Question about mythfilldatabase?

David Yoder dyoderatucsd at gmail.com
Sun Oct 25 09:35:40 UTC 2009


Michael T. Dean wrote:
> You'll need to update a setting in the database.  It's the setting, 
> "MythFillSuggestedRunTime" and should have a format such as 
> "2009-10-25T19:16:30".
>
> The best way to set it is to use the MythXML interface.  It takes care 
> of properly flushing the settings cache to ensure the backend uses the 
> value.  You can use it in a command-line script by simply sending an 
> HTTP request with wget or curl or whatever.
>
> wget -O result.xml 
> 'http://localhost:6544/Myth/PutSetting?HostName=&Key=MythFillSuggestedRunTime&Value=2009-10-25T19:16:30' 
>
>
> Note the blank value for HostName.  It's critical that you put that 
> there.
>
> Sorry I forgot to mention that in the first place.
>
> Mike

OK, looks like I'm cooking with gas now! Thanks, btw, for your help 
pointing me in the right direction. I rewrote the grabber script in perl 
to simplify things and, quite frankly, because it looks neater (to me). 
Below is what I have done on my system. Mind you, this is setup for a 
single lineup. It's a relatively minor change in the scripts to be able 
to iterate over a list of lineups, if one needs to add that.

1) Ran /usr/bin/tv_grab_na_dd --configure
2) Changed the mythfilldatabase command in the MythTV settings (on my 
system, it's under General settings, mythfilldatabase Program in the 
setup on the frontend) to /usr/bin/my_grab.pl (see below for that script).
3) Added a cron job for /usr/bin/my_mythfilldatabase.sh (also see below 
for script) to run at a time of my choosing, 4 a.m. (I.e., ran crontab 
-e as mythtv and added the line "0 4 * * *       
/usr/bin/my_mythfilldatabase.sh" without the quotes, of course)
4) Started enjoying my new life without worrying about mythfilldatabase 
bogging things down at inopportune times!

I sincerely hope this will help anyone else who may be in my shoes.

--David


-------START my_grab.pl-------

#!/usr/bin/perl

use POSIX qw(strftime);
use LWP::Simple;

$backend_host = "localhost";
$dumpdir = "/tmp/dd_dumps";
$xmlconf = "/home/mythtv/.xmltv/tv_grab_na_dd.conf";
$grabcmd = "/usr/bin/tv_grab_na_dd";
$dumpfile = strftime ("%Y%m%d", localtime() ) . "_$$";

unless ( -d $dumpdir ) {
        mkdir("$dumpdir", 0755) || die $!;
}

system("rm -f $dumpdir/*");

$grabargs = join(" ",
     "--config-file $xmlconf",
     "--days 14",
     "--download-only",
     "--list-times",
     "--dd-data $dumpdir/$dumpfile"
    );

open(GRAB, "$grabcmd $grabargs 2>&1 |");
open(LOG, ">$dumpdir/grab.log") || die $!;
while (<GRAB>) {
        print;
        print LOG;
        $sugtime = $1 if /^suggestedTime\s*\|(.*)$/;
}
close(GRAB);

$xmlres = 
get("http://$backend_host:6544/Myth/PutSetting?HostName=&Key=MythFillSuggestedRunTime&Value=$sugtime");
print $xmlres . "\n";
print LOG $xmlres . "\n";

symlink("$dumpdir/$dumpfile", "$dumpdir/dd_data.raw");

-------END my_grab.pl-------

-------START my_mythfilldatabase.sh-------

#!/bin/sh

# Change the following line to the location of your config file
xmlconf="/home/mythtv/.xmltv/tv_grab_na_dd.conf"

lineupid=`grep "lineup:" $xmlconf|awk '{print $2}'`

[ -f /tmp/dd_dumps/dd_data.raw ] && /usr/bin/mythfilldatabase --dd-file 
1 -1 $lineupid /tmp/dd_dumps/dd_data.raw

-------END my_mythfilldatabase.sh-------


More information about the mythtv-users mailing list