[mythtv] [PATCH] Split program.{start, end}time into separate date and time columns

David Engel gigem at comcast.net
Mon Mar 22 00:30:28 EST 2004


On Sat, Mar 20, 2004 at 10:12:25PM -0600, David Engel wrote:
> On Sat, Mar 20, 2004 at 04:15:12PM -0800, Matt Zimmerman wrote:
> > OK, here's a first cut at a more conservative approach.  It does the
> > following:
> > ...
> > It'd be great if someone could give this a try.
> 
> My myth box should be free tomorrow evening, so I will try to give it
> a shot then.

I did my taxes tonight so I didn't have as much time for this as I
planned.  However, the attached patch seems to get basic scheduling
working.  Overrides are broken, probably because not all of the
columns are set in setOverride.  At best, the next opportunity I will
to test any more is Thursday.

David
-- 
David Engel
gigem at comcast.net
-------------- next part --------------
--- mythtv-test.orig/libs/libmythtv/dbcheck.cpp	2004-03-21 23:11:57.000000000 -0600
+++ mythtv-test/libs/libmythtv/dbcheck.cpp	2004-03-21 22:09:01.000000000 -0600
@@ -8,7 +8,7 @@
 
 #include "mythcontext.h"
 
-const QString currentDatabaseVersion = "1035";
+const QString currentDatabaseVersion = "1036";
 
 void UpdateDBVersionNumber(const QString &newnumber)
 {
@@ -692,9 +692,11 @@
              "ALTER TABLE program ADD INDEX (startdate,enddate);",
              "ALTER TABLE recordoverride CHANGE COLUMN starttime startts TIMESTAMP;",
              "ALTER TABLE recordoverride CHANGE COLUMN endtime endts TIMESTAMP;",
+""
         };
 
         performActualUpdate(updates, "1036", dbver);
+        cout << "after db update" << endl;
     }
 }
 
--- mythtv-test.orig/programs/mythbackend/scheduler.cpp	2004-03-21 23:11:57.000000000 -0600
+++ mythtv-test/programs/mythbackend/scheduler.cpp	2004-03-21 23:10:38.000000000 -0600
@@ -1172,8 +1172,8 @@
          "IF(cardinput.preference IS NOT NULL,cardinput.preference,0), "
          "record.dupin, recorded.endtime, record.type, "
          "record.recordid, recordoverride.type, "
-         "program.starttime - INTERVAL record.startoffset minute, "
-         "program.endtime + INTERVAL record.endoffset minute, "
+         "program.startts - INTERVAL record.startoffset minute, "
+         "program.endts + INTERVAL record.endoffset minute, "
          "program.previouslyshown, record.recgroup, record.dupmethod, "
          "channel.commfree, capturecard.cardid, "
          "cardinput.cardinputid, UPPER(cardinput.shareable) = 'Y' AS shareable "
@@ -1262,10 +1262,10 @@
     while (query.next())
     {
         // Don't bother if card isn't on-line of end time has already passed
-        int cardid = query.value(24).toInt();
+        int cardid = query.value(26).toInt();
         if (threadrunning && !cardMap.contains(cardid))
             continue;
-        QDateTime recendts = query.value(19).toDateTime();
+        QDateTime recendts = query.value(21).toDateTime();
         if (recendts < schedTime)
             continue;
 
@@ -1273,28 +1273,28 @@
         p->recstatus = rsUnknown;
         p->chanid = query.value(0).toString();
         p->sourceid = query.value(1).toInt();
-        p->startts = query.value(2).asDateTime();
-        p->endts = query.value(3).asDateTime();
-        p->title = QString::fromUtf8(query.value(4).toString());
-        p->subtitle = QString::fromUtf8(query.value(5).toString());
-        p->description = QString::fromUtf8(query.value(6).toString());
-        p->chanstr = query.value(7).toString();
-        p->chansign = query.value(8).toString();
-        p->channame = QString::fromUtf8(query.value(9).toString());
-        p->category = QString::fromUtf8(query.value(11).toString());
-        p->recpriority = query.value(12).toInt();
-        p->dupin = RecordingDupInType(query.value(13).toInt());
-        p->dupmethod = RecordingDupMethodType(query.value(22).toInt());
-        p->rectype = RecordingType(query.value(15).toInt());
-        p->recordid = query.value(16).toInt();
-        p->override = query.value(17).toInt();
+        p->startts = QDateTime(query.value(3).asDate(), query.value(2).asTime());
+        p->endts = QDateTime(query.value(5).asDate(), query.value(4).asTime());
+        p->title = QString::fromUtf8(query.value(6).toString());
+        p->subtitle = QString::fromUtf8(query.value(7).toString());
+        p->description = QString::fromUtf8(query.value(8).toString());
+        p->chanstr = query.value(9).toString();
+        p->chansign = query.value(10).toString();
+        p->channame = QString::fromUtf8(query.value(11).toString());
+        p->category = QString::fromUtf8(query.value(13).toString());
+        p->recpriority = query.value(14).toInt();
+        p->dupin = RecordingDupInType(query.value(15).toInt());
+        p->dupmethod = RecordingDupMethodType(query.value(24).toInt());
+        p->rectype = RecordingType(query.value(17).toInt());
+        p->recordid = query.value(18).toInt();
+        p->override = query.value(19).toInt();
 
-        p->recstartts = query.value(18).toDateTime();
+        p->recstartts = query.value(20).toDateTime();
         p->recendts = recendts;
-        p->chancommfree = query.value(23).toInt();
+        p->chancommfree = query.value(25).toInt();
         p->cardid = cardid;
-        p->inputid = query.value(25).toInt();
-        p->shareable = query.value(26).toInt();
+        p->inputid = query.value(27).toInt();
+        p->shareable = query.value(28).toInt();
 
         if (!recTypeRecPriorityMap.contains(p->rectype))
             recTypeRecPriorityMap[p->rectype] = 
@@ -1311,8 +1311,8 @@
             p->recendts = p->endts;
         }
 
-        p->repeat = query.value(20).toInt();
-        p->recgroup = query.value(21).toString();
+        p->repeat = query.value(22).toInt();
+        p->recgroup = query.value(23).toString();
 
         p->schedulerid = 
             p->startts.toString() + "_" + p->chanid;
@@ -1372,14 +1372,14 @@
         {
             if (p->dupin & kDupsInOldRecorded)
             {
-                if (!query.value(10).isNull() &&
-                    query.value(10).toDateTime() < p->recstartts)
+                if (!query.value(12).isNull() &&
+                    query.value(12).toDateTime() < p->recstartts)
                     p->recstatus = rsPreviousRecording;
             }
             if (p->dupin & kDupsInRecorded)
             {
-                if (!query.value(14).isNull() &&
-                    query.value(14).toDateTime() < p->recstartts)
+                if (!query.value(16).isNull() &&
+                    query.value(16).toDateTime() < p->recstartts)
                     p->recstatus = rsCurrentRecording;
             }
         }


More information about the mythtv-dev mailing list