[mythtv] Patch for mythfilldatabase --no-delete

Andrew M. Bishop amb at gedanken.demon.co.uk
Mon Feb 28 19:24:45 UTC 2005


Oscar Carlsson <webmaster at trekotor.se> writes:

> Andrew M. Bishop wrote, On 2005-02-27 10:13:
> > Somewhere between version 0.16 and version 0.17 the code for the
> > --no-delete option to mythfilldatabase was changed.  The use of the
> > no_delete variable was inverted in one of the if() statements.
> 
> > The first of the two attached patches (mythfilldatabase.patch1.diff)
> > fixes this.  Without the fix there are thousands of sql insert errors
> > and the database ends up with overlapping programs.  It might have
> > been changed this way for a reason rather than in error, in that case
> > you might want to consider making this code run for both options.
> 
>  From the help:
> 
> "--no-delete
>     Do not delete old programs from the database until 7 days old.
>     Do not delete existing programs from the database when updating."
> 
> It works that way, right? You mean that the last part should be removed,
> and only the 7 days old part of the functionality should be kept?
> Don't see how that text differs from the current behaviour.

I am the original author of the --no-delete option to mythfilldatabase
nearly two years ago, as I told Isaac at the time that I sent the
patch:

: I have added a new option to mythfilldatabase, called '--no-delete'.
: 
: This option does two things:
: 
: 1) when it gets new data from XMLTV it won't delete the existing data
:    day-by-day but program-by-program.  This means that if a single
:    program changes between grabs of data by XMLTV it will only update
:    that one.
: 
: 2) it only deletes programs from the database when they are more than
:    a week old.

With the error that has been introduced between version 0.16 and 0.17
the first of these doesn't get done.  This means that since there is
already an identical progam in the database (because it wasn't
deleted) the new program when added causes an SQL error.  Also a new
program with a different start time causes two overlapping programs in
the guide.

If you have not deleted the old programs from the database then you
*must* check when inserting a new program that (a) it isn't already
there and (b) that it doesn't overlap with an existing program.  The
patch I sent restores part (b) of this behaviour so that it works
again.

The help text is the same as version 0.16, and probably isn't perfect.
A better description for the help text would be:

"--no-delete
    Do not delete old programs from the database until 7 days old.
    Delete programs only if conflicting not the whole day when updating."

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             amb at gedanken.demon.co.uk
                                      http://www.gedanken.demon.co.uk/


More information about the mythtv-dev mailing list