From dcfe7b09279f8768c0dbc1fbeb588e06aa9d9e44 Mon Sep 17 00:00:00 2001 From: David Engel Date: Mon, 13 Feb 2012 16:49:05 -0600 Subject: [PATCH] Make more title and callsign comparisons case insensitive. 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 --- mythtv/libs/libmyth/programinfo.cpp | 10 ++++++---- mythtv/programs/mythbackend/scheduler.cpp | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index 21d360781c3..d53f6463aef 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -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; @@ -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; diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index c612540f5fa..8747660d3fe 100644 --- a/mythtv/programs/mythbackend/scheduler.cpp +++ b/mythtv/programs/mythbackend/scheduler.cpp @@ -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(); } @@ -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()) @@ -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())