[mythtv] [patch] Small improvement to "record this timeslot every week"

Dan Schwarz mythtv-dev@snowman.net
Sun, 24 Nov 2002 22:31:31 -0500


The program guide is smart enough to detect programs that repeat daily 
or weekly and give you the option to record those shows in that same 
timeslot every week.  It does this by looking ahead in the program guide 
1 day and 7 days, and comparing the titles of the programs in the same 
timeslots. If it doesn't find the same program in the timeslot /or if it 
finds no data for that day/ it will not display the "timeslot" option.

That's great, but Mythfilldatabase only loads 7 days worth of program 
data starting from today's date.  So if you browse ahead in the program 
guide to a future date, you will not be able to set mythtv to record any 
program in the same timeslot in a future week.

This patch implements the following change:  If there is no program data 
7 days out from this program's timeslot, it will still allow you to 
record that show in the same timeslot every week.  /It's trusting you to 
know that the program does, in fact, repeat every week./   I think 
that's fine.

By the way, I can't get Emacs to follow mythtv's indentation rules at 
all. Anyone out there have a config file to get emacs to indent in 
Issac's style?

Regards,
Dan

Index: infodialog.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/infodialog.cpp,v
retrieving revision 1.24
diff -u -r1.24 infodialog.cpp
--- infodialog.cpp      15 Nov 2002 06:02:03 -0000      1.24
+++ infodialog.cpp      25 Nov 2002 03:23:19 -0000
@@ -139,7 +139,7 @@
     QString msg = "Shouldn't show up.";
     if (programtype == 1)
         msg = "Record this program in this timeslot every day";
-    else if (programtype == 2)
+    else if (programtype == 2 || programtype == -1)
         msg = "Record this program in this timeslot every week";
     if (programtype != 0)
     {
Index: programinfo.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/programinfo.cpp,v
retrieving revision 1.16
diff -u -r1.16 programinfo.cpp
--- programinfo.cpp     11 Nov 2002 04:38:25 -0000      1.16
+++ programinfo.cpp     25 Nov 2002 03:23:23 -0000
@@ -157,7 +157,7 @@
     return GetProgramAtDateTime(channel, sqltime);
 }

-// 0 for no, 1 for weekdaily, 2 for weekly.
+//  -1 for no data, 0 for no, 1 for weekdaily, 2 for weekly
 int ProgramInfo::IsProgramRecurring(void)
 {
     QDateTime dtime = startts;
@@ -174,6 +174,11 @@

         ProgramInfo *nextday = GetProgramAtDateTime(chanid, checktime);

+        if (NULL == nextday)
+        {
+            return -1;
+        }
+
         if (nextday && nextday->title == title)
         {
             delete nextday;
@@ -185,6 +190,11 @@