Skip to content

Commit

Permalink
Make more title and callsign comparisons case insensitive.
Browse files Browse the repository at this point in the history
The callsign checks were never expected to need case insensitive
checks, but since the database does it that way, so must we to avoid
strange results.

Fixes #10331
  • Loading branch information
gigem committed Feb 13, 2012
1 parent ab4a02f commit dcfe7b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
10 changes: 6 additions & 4 deletions mythtv/libs/libmyth/programinfo.cpp
Expand Up @@ -1947,11 +1947,12 @@ bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const
*/
bool ProgramInfo::IsSameTimeslot(const ProgramInfo& other) const
{
if (title != other.title)
if (title.toLower() != other.title.toLower())
return false;
if (startts == other.startts &&
(chanid == other.chanid ||
(!chansign.isEmpty() && chansign == other.chansign)))
(!chansign.isEmpty() &&
chansign.toLower() == other.chansign.toLower())))
return true;

return false;
Expand All @@ -1965,10 +1966,11 @@ bool ProgramInfo::IsSameTimeslot(const ProgramInfo& other) const
*/
bool ProgramInfo::IsSameProgramTimeslot(const ProgramInfo &other) const
{
if (title != other.title)
if (title.toLower() != other.title.toLower())
return false;
if ((chanid == other.chanid ||
(!chansign.isEmpty() && chansign == other.chansign)) &&
(!chansign.isEmpty() &&
chansign.toLower() == other.chansign.toLower())) &&
startts < other.endts &&
endts > other.startts)
return true;
Expand Down
21 changes: 14 additions & 7 deletions mythtv/programs/mythbackend/scheduler.cpp
Expand Up @@ -278,12 +278,16 @@ static bool comp_redundant(RecordingInfo *a, RecordingInfo *b)
return a->GetScheduledEndTime() < b->GetScheduledEndTime();

// Note: the PruneRedundants logic depends on the following
if (a->GetTitle() != b->GetTitle())
return a->GetTitle() < b->GetTitle();
QString astr = a->GetTitle().toLower();
QString bstr = b->GetTitle().toLower();
if (astr != bstr)
return astr < bstr;
if (a->GetRecordingRuleID() != b->GetRecordingRuleID())
return a->GetRecordingRuleID() < b->GetRecordingRuleID();
if (a->GetChannelSchedulingID() != b->GetChannelSchedulingID())
return a->GetChannelSchedulingID() < b->GetChannelSchedulingID();
astr = a->GetChannelSchedulingID().toLower();
bstr = b->GetChannelSchedulingID().toLower();
if (astr != bstr)
return astr < bstr;
return a->GetRecordingStatus() < b->GetRecordingStatus();
}

Expand All @@ -293,8 +297,10 @@ static bool comp_recstart(RecordingInfo *a, RecordingInfo *b)
return a->GetRecordingStartTime() < b->GetRecordingStartTime();
if (a->GetRecordingEndTime() != b->GetRecordingEndTime())
return a->GetRecordingEndTime() < b->GetRecordingEndTime();
if (a->GetChannelSchedulingID() != b->GetChannelSchedulingID())
return a->GetChannelSchedulingID() < b->GetChannelSchedulingID();
QString astr = a->GetChannelSchedulingID().toLower();
QString bstr = b->GetChannelSchedulingID().toLower();
if (astr != bstr)
return astr < bstr;
if (a->GetRecordingStatus() != b->GetRecordingStatus())
return a->GetRecordingStatus() < b->GetRecordingStatus();
if (a->GetChanNum() != b->GetChanNum())
Expand Down Expand Up @@ -711,7 +717,8 @@ void Scheduler::SlaveConnected(RecordingList &slavelist)

if (sp->GetInputID() &&
sp->GetScheduledStartTime() == rp->GetScheduledStartTime() &&
sp->GetChannelSchedulingID() == rp->GetChannelSchedulingID() &&
sp->GetChannelSchedulingID().toLower() ==
rp->GetChannelSchedulingID().toLower() &&
sp->GetTitle() == rp->GetTitle())
{
if (sp->GetCardID() == rp->GetCardID())
Expand Down

0 comments on commit dcfe7b0

Please sign in to comment.