[mythtv] changes to conflict resolution

Craig Longman craigl at begeek.com
Thu Jun 5 02:10:24 EDT 2003


Matt Zimmerman wrote:

>On Thu, Jun 05, 2003 at 12:04:49AM -0400, Craig Longman wrote:
>  
>
>>anyway, i've just changed the behaviour of PruneList to not actually
>>remove the entries, but simply mark them as not being recorded.  they will
>>get removed from the list if the doautoconflicts parm is true.  i'll have
>>a better idea of whats going on when i can actually see the programs that
>>should be recorded and which ones are being selected.
>>    
>>
>Can you send your patch?  This should probably be fixed.
>
i will.  it works pretty well.  the main scheduler server still gets 
'the right stuff', removing ones that shouldn't be recorded, but the 
resolve conflicts now gets the full list, with the ones that PruneList() 
was removing now greyed out.  it makes _much_ more sense to me now, its 
pretty neat the way it does basic conflict resolving actually.  cool!

anyway, the patch is attached. its pretty basic, i've tried to comment 
what i've done and what the code actually does (afaict, if its 
incorrect, please remove it, the only thing worse than no comments are 
inaccurate comments).

it reuses the ProgramInfo::duplicate member a bit though, where as 
before duplicate really did mean something was already recorded (as the 
'unsuppress recording' option indicates), now it could also mean two 
more things:
1) it is going to be recorded before this airing
2) it is going to be recorded after this airing, but because this one 
conflicts and the next one doesn't, we've opted to record the next one.
i can't quite read all the text of the new 'unsuppress recording' 
dialog, but we might want to update that text to at least allude to the 
other meanings of duplicates.

or perhaps another member would be in order?  i don't really think so, 
in essence this _is_ a duplicate, even though it hasn't actually been 
recorded yet.  i think updating the text would be perfect.  i don't want 
to just update the text myself, perhaps someone else could figure a good 
way of wording the existing meaning, and include the 2 new meanings?

one last thing though.  i didn't want to make this change right now, but 
i wonder if the check for IsSameProgram() couldn't/shouldn't happen 
before the check for IsSameTimeslot().  this would make cases where the 
same program is on at the same time not show up as a conflict.  i just 
resynced with cvs and am having to do a distclean make, so it will be a 
while before i can try it.  anyway, this works quite well, at least as a 
starting point for people to test it out.

cheers,

    CraigL->Thx();

-------------- next part --------------
Index: programs/mythbackend/scheduler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/scheduler.cpp,v
retrieving revision 1.24
diff -d -u -r1.24 scheduler.cpp
--- programs/mythbackend/scheduler.cpp  21 May 2003 01:10:24 -0000      1.24
+++ programs/mythbackend/scheduler.cpp  5 Jun 2003 04:52:30 -0000
@@ -356,8 +356,9 @@

         ProgramInfo *first = (*i);

-        if (first->GetProgramRecordingStatus(db) > ScheduledRecording::SingleRecord &&
-            (first->subtitle.length() > 2 && first->description.length() > 2))
+        if (first->recording &&
+            first->GetProgramRecordingStatus(db) > ScheduledRecording::SingleRecord &&
+            (first->subtitle.length() > 2 && first->description.length() > 2 ))
         {
             if (first->duplicate)
             {
@@ -370,34 +371,36 @@
                     ProgramInfo *second = (*j);
                     if (first->IsSameTimeslot(*second))
                     {
-                        delete second;
-                        deliter = j.base();
-                        j++;
-                        deliter--;
-                        recordingList.erase(deliter);
+                      // we have a conflict, so mark the second (lower chanid) one as disabled
+                      // it will be actually marked as in conflict in MarkConflicts()
+                        second->recording = false;
                     }
                     else if (first->IsSameProgram(*second))
                     {
+                      // same show, so try and see if we can resolve a conflict easily
                         if (second->conflicting && !first->conflicting)
                         {
-                            delete second;
-                            deliter = j.base();
-                            j++;
-                            deliter--;
-                            recordingList.erase(deliter);
+                          // mark the second as not being recorded, but also indicate that
+                          // it is actually being recorded elsewhere (duplicate)
+                            second->recording = false;
+                            second->duplicate = true;
                         }
                         else
                         {
-                            delete first;
-                            deliter = i.base();
-                            deliter--;
-                            recordingList.erase(deliter);
+                          // mark the first as not being recorded, but also indicate that
+                          // it is actually being recorded elsewhere (duplicate)
+                            first->recording = false;
+                            first->duplicate = true;
+
+                          // we can now break out, as we've disabled the first recording,
+                          // which is the one we were comparing against
                             break;
                         }
                     }
                 }
             }
         }
+
         i++;
     }
 }


More information about the mythtv-dev mailing list