[mythtv] PATCH - Fix number of upcoming recordings in 6544

Kirby Vandivort kvandivo at ks.uiuc.edu
Mon Jun 7 23:29:05 EDT 2004


This patch fixes a little bug that I? had apparently introduced
way back when...  When counting the number of upcoming recordings,
the code was just checking the size of the vector, without
subtracting out items in the vector that weren't actually going
to be recorded.

Now, I run through the list once and add up the number of entries
that are actually going to be recorded to get the number.  This
had always been hidden before thanks the max number of 10.  Now
that summer is here and not much is recording the number of
actual recordings that I had dropped below ten, but 6544 was
still telling me that it had 10 upcoming recordings.

-- 

Kirby Vandivort                      Theoretical and 
Senior Research Programmer            Computational Biophysics 
Email: kvandivo at ks.uiuc.edu          3051 Beckman Institute
http://www.ks.uiuc.edu/~kvandivo/    University of Illinois
Phone: (217) 244-5711                405 N. Mathews Ave
Fax  : (217) 244-6078                Urbana, IL  61801, USA
-------------- next part --------------
Index: programs/mythbackend/mainserver.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/mainserver.cpp,v
retrieving revision 1.144
diff -b -u -2 -r1.144 mainserver.cpp
--- programs/mythbackend/mainserver.cpp	4 Jun 2004 05:37:56 -0000	1.144
+++ programs/mythbackend/mainserver.cpp	8 Jun 2004 03:22:49 -0000
@@ -3069,7 +3100,24 @@
         m_sched->getAllPending(&recordingList);
 
+    list<ProgramInfo *>::iterator iterCnt = recordingList.begin();
+
     unsigned int iNum = 10;
-    if (recordingList.size() < iNum) 
-        iNum = recordingList.size();
+
+    // count the number of upcoming recordings
+    unsigned int iNumRecordings = 0;
+    while (iterCnt != recordingList.end())
+    {
+        if (!((*iterCnt)->recstatus > rsWillRecord ||     
+               ((*iterCnt)->recstartts) < QDateTime::currentDateTime())) 
+        {                       
+               iNumRecordings++;
+        }
+
+        if (iNumRecordings > iNum) break;
+        iterCnt++;
+    }
+
+    if (iNumRecordings < iNum) 
+        iNum = iNumRecordings;
 
     if (iNum == 0)
@@ -3082,5 +3130,7 @@
 
        os << "    <div id=\"schedule\">\r\n";
+
        list<ProgramInfo *>::iterator iter = recordingList.begin();
+
        for (unsigned int i = 0; (iter != recordingList.end()) && i < iNum; 
             iter++, i++)


More information about the mythtv-dev mailing list