[mythtv] mythfilldatabase bug

Ove Kaaven ovehk at ping.uio.no
Tue Apr 27 15:09:13 EDT 2004


man, 26.04.2004 kl. 18.21 skrev Andrew M. Bishop:
> Ove Kaaven <ovehk at ping.uio.no> writes:
> 
> > It seems to me that the logic for --no-delete in mythfilldatabase is
> > reversed; when the flag is absent, it does not delete old entries for
> > me, but probably will if it's present. How about either something like
> > this (untested change):
> 
> You don't say what version of myth you are using,

The patch headers should make it clear that it was against CVS. But I
use Debian version 0.14-6.

> but since I added
> the --no-delete option I thought that I should answer.  The code in
> myth version 0.14 is correct and does work.

Not quite to my liking.

> The --no-delete option doesn't delete all the entries from the
> database before grabbing new ones, but instead it deletes only the
> entries that have changed after the grabber has run.  This means that
> if you run mythfilldatabase from a cron job and it fails to download
> anything one day you stil have the data you downloaded previously.
> You don't have to check every day that the download was OK.

Well, I had expected the *absence* of --no-delete to cause all the
entries to be deleted, which is apparently not the case, as I get a lot
of messages from cron about insert errors every day if I don't use
--no-delete. And for principled reasons (such as "fix the bug instead of
using stupid workarounds") I've tried to avoid using it, so I kinda
wanted old data to get deleted without using the option.

I suppose it's possible that the problem really is the xmltv grabber I'm
using that grabs more data than it should (if it's told to grab data for
Saturday, it might perhaps sometimes grab till 5 in the morning on
Sunday or something), and that this breaks some expectations. Perhaps
the patch I'd really want would be more like

Index: filldata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfilldatabase/filldata.cpp,v
retrieving revision 1.102
diff -u -r1.102 filldata.cpp
--- filldata.cpp	21 Apr 2004 03:23:33 -0000	1.102
+++ filldata.cpp	27 Apr 2004 18:51:09 -0000
@@ -1510,7 +1510,6 @@
             if ("" == (*i).stars)
                 (*i).stars = "0";
 
-            if (no_delete)
             {
                 querystr.sprintf("SELECT * FROM program WHERE chanid=%d AND "
                                  "starttime=\"%s\" AND endtime=\"%s\" AND "
@@ -1528,7 +1527,10 @@
 
                 if (query.isActive() && query.numRowsAffected() > 0)
                     continue;
+            }
 
+            if (no_delete)
+            {
                 querystr.sprintf("SELECT title,subtitle,starttime,endtime "
                                  "FROM program WHERE chanid=%d AND "
                                  "starttime>=\"%s\" AND starttime<\"%s\";",

But should I just start using --no-delete instead? Or should the xmltv
grabber be made more intelligent (possibly at the cost of making it have
to do more webpage fetches if the TV station's listings are fixed at
06:00-06:00 fetches, not 00:00-00:00 fetches)?




More information about the mythtv-dev mailing list