[mythtv] [patch] remove database errors when start time > end time

Andrew M. Bishop amb at gedanken.demon.co.uk
Fri Jun 18 06:29:20 EDT 2004


Isaac Richards <ijr at po.cwru.edu> writes:

> On Sunday 06 June 2004 04:29 am, Andrew M. Bishop wrote:
> > Sometimes the data from xmltv is wrong and the start time listed for a
> > program is later than the end time.  This seems to happen a lot with
> > the UK bleb.org data.
> >
> > This patch just ignores any programs where the start time is later
> > than the end time so that we don't try inserting them into the
> > database and therefore don't get the errors.
> 
> Applied this, too..

Here is a better patch that you should apply on top of the existing
one.  It replaces the previous one and uses the pre-existing feature
in mythfilldatabase to work out missing end times.  If the start time
is before the end time it behaves as if the end time is missing.

The other twiddle on this is that if the end time is before 6am and
there is no following program then the end time is assumed to be 6am
rather than midnight.  This is because the grabbed UK times are 6am to
6am, this shouldn't affect anybody whose grabber gets times in
midnight to midnight periods.

Note to bleb.org users: the previous patch removed all database
insertion errors because it ignored bad program data.  This new patch
will show up some database insertion errors due to bad data,
e.g. programs that show up twice.

-------------- next part --------------
--- /home/amb/mythtv/v0.15.1/mythtv/programs/mythfilldatabase/filldata.orig.cpp	2004-06-06 09:20:15.000000000 +0100
+++ /home/amb/mythtv/v0.15.1/mythtv/programs/mythfilldatabase/filldata.cpp	2004-06-18 11:16:17.000000000 +0100
@@ -1443,13 +1443,6 @@
                     if (!pginfo->desc.isEmpty())
                         groupingDesc = pginfo->desc + " : ";
                 }
-                else if (pginfo->startts > pginfo->endts)
-                {
-                    cerr << "invalid program (start > end): "
-                         << pginfo->channel << " "
-                         << pginfo->title.local8Bit() << " "
-                         << pginfo->startts << "-" << pginfo->endts << endl;
-                }
                 else
                 {
                     if (pginfo->clumpidx.isEmpty())
@@ -1527,7 +1520,7 @@
         cur = i;
         i++;
         // fill in miss stop times
-        if ((*cur).endts == "")
+        if ((*cur).endts == "" || (*cur).startts > (*cur).endts)
         {
             if (i != fixlist->end())
             {
@@ -1537,8 +1530,16 @@
             else
             {
                 (*cur).end = (*cur).start;
-                (*cur).end.setTime(QTime(0, 0));
-                (*cur).end.setDate((*cur).end.date().addDays(1));
+
+                if ((*cur).end < QDateTime((*cur).end.date(),QTime(6, 0)))
+                {
+                    (*cur).end.setTime(QTime(6, 0));
+                }
+                else
+                {
+                    (*cur).end.setTime(QTime(0, 0));
+                    (*cur).end.setDate((*cur).end.date().addDays(1));
+                }
 
                 (*cur).endts = (*cur).end.toString("yyyyMMddhhmmss").ascii();
             }
-------------- next part --------------

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


More information about the mythtv-dev mailing list