[mythtv] Minor bug in scheduler

Benjamin Binford mythtv-dev@snowman.net
Thu, 5 Dec 2002 12:13:24 -0500


--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I think I've uncovered a minor bug in the scheduler. This is easiest
to reproduce if you have back to back episodes of a tv show somewhere
in your schedule. On one of the shows select a timeslot record, on the other select record all. If you look into the fix conflicts screen you'll see that for the show that you selected timeslot record there are duplicate entries.

Attached is a patch which fixes this by checking for duplicate shows
on the same channel, source, and time in Scheduler::PruneList in addition to checking for description and title matching. 

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="schedulerfix.patch"

Index: libs/libmyth/programinfo.cpp
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/programinfo.cpp,v
retrieving revision 1.18
diff -r1.18 programinfo.cpp
514a515,544
> 
> 
> 
> bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const
> {
>     if (title == other.title &&
> 	subtitle.length() > 2 &&
> 	description.length() > 2 &&
> 	subtitle == other.subtitle &&
> 	description == other.description)
>       return true;
>     else
>       return false;
> }
>   
> bool ProgramInfo::IsSameTimeslot(const ProgramInfo& other) const
> {
>     if (chanid == other.chanid &&
> 	startts == other.startts &&
> 	endts == other.endts &&
> 	sourceid == other.sourceid &&
> 	cardid == other.cardid &&
> 	inputid == other.inputid)
>       return true;
>     else
>       return false;
> }
> 
> 
> 
Index: libs/libmyth/programinfo.h
===================================================================
RCS file: /var/lib/cvs/MC/libs/libmyth/programinfo.h,v
retrieving revision 1.10
diff -r1.10 programinfo.h
24c24,25
< 
---
>     bool IsSameProgram(const ProgramInfo& other) const;
>     bool IsSameTimeslot(const ProgramInfo& other) const;
Index: programs/mythfrontend/scheduler.cpp
===================================================================
RCS file: /var/lib/cvs/MC/programs/mythfrontend/scheduler.cpp,v
retrieving revision 1.30
diff -r1.30 scheduler.cpp
514c514
<     if (pginfo->subtitle == "" || pginfo->description == "")
---
>     if (pginfo->subtitle.length() <= 2 || pginfo->description.length() < 2)
541,543c541,542
< 
<         if (first->recordtype > kSingleRecord && 
<             (first->subtitle.length() > 2 && first->description.length() > 2))
---
> 	
>         if (first->recordtype > kSingleRecord)
555a555
> 		  
557,560c557,565
<                     if ((first->title == second->title) && 
<                         (first->subtitle == second->subtitle) &&
<                         (first->description == second->description) &&
<                         first->subtitle != "" && first->description != "")
---
> 		    if (first->IsSameTimeslot(*second))
> 		    {
> 		        delete second;
>                         deliter = j.base();
>                         j++;
>                         deliter--;
>                         recordingList.erase(deliter);
> 		    }
> 		    else if (first->IsSameProgram(*second))
562c567
<                         if (second->conflicting && !first->conflicting)
---
> 		      if (second->conflicting && !first->conflicting)

--6TrnltStXW4iwmi0--