From a42bfc612f8ccd0b15bc2474ae27d53f33ba6dda Mon Sep 17 00:00:00 2001 From: David Engel Date: Tue, 16 Aug 2011 11:05:10 -0500 Subject: [PATCH] Enhanced "Subtitle then Description" duplicate checking. Some EIT providers reportedly put the subtitle in the description field in some situations. This change extends the "Subtitle then Description" logic to account for it. Based on a patch from lomion0815. Fixes #9985. --- mythtv/libs/libmyth/programinfo.cpp | 14 ++++++++---- mythtv/programs/mythbackend/scheduler.cpp | 26 ++++++++++++++++------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index 3010351a49a..f292b6eb882 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -1893,10 +1893,16 @@ bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const return false; if ((dupmethod & kDupCheckSubThenDesc) && - ((subtitle.isEmpty() && other.subtitle.isEmpty() && - description.toLower() != other.description.toLower()) || - (subtitle.toLower() != other.subtitle.toLower()) || - (description.isEmpty() && subtitle.isEmpty()))) + ((subtitle.isEmpty() && + ((!other.subtitle.isEmpty() && + description.toLower() != other.subtitle.toLower()) || + (other.subtitle.isEmpty() && + description.toLower() != other.description.toLower()))) || + (!subtitle.isEmpty() && + ((other.subtitle.isEmpty() && + subtitle.toLower() != other.description.toLower()) || + (!other.subtitle.isEmpty() && + subtitle.toLower() != other.subtitle.toLower()))))) return false; return true; diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index 195aea57d40..354de46d1c7 100644 --- a/mythtv/programs/mythbackend/scheduler.cpp +++ b/mythtv/programs/mythbackend/scheduler.cpp @@ -3684,10 +3684,15 @@ void Scheduler::AddNewRecords(void) " (((RECTABLE.dupmethod & 0x04) = 0) OR (program.description <> '' " " AND program.description = oldrecorded.description)) " " AND " -" (((RECTABLE.dupmethod & 0x08) = 0) OR (program.subtitle <> '' " -" AND program.subtitle = oldrecorded.subtitle) OR (program.subtitle = '' " -" AND oldrecorded.subtitle = '' AND program.description <> '' " -" AND program.description = oldrecorded.description)) " +" (((RECTABLE.dupmethod & 0x08) = 0) OR " +" (program.subtitle <> '' AND " +" (program.subtitle = oldrecorded.subtitle OR " +" (oldrecorded.subtitle = '' AND " +" program.subtitle = oldrecorded.description))) OR " +" (program.subtitle = '' AND program.description <> '' AND " +" (program.description = oldrecorded.subtitle OR " +" (oldrecorded.subtitle = '' AND " +" program.description = oldrecorded.description)))) " " ) " " ) " " ) " @@ -3716,10 +3721,15 @@ void Scheduler::AddNewRecords(void) " (((RECTABLE.dupmethod & 0x04) = 0) OR (program.description <> '' " " AND program.description = recorded.description)) " " AND " -" (((RECTABLE.dupmethod & 0x08) = 0) OR (program.subtitle <> '' " -" AND program.subtitle = recorded.subtitle) OR (program.subtitle = '' " -" AND recorded.subtitle = '' AND program.description <> '' " -" AND program.description = recorded.description)) " +" (((RECTABLE.dupmethod & 0x08) = 0) OR " +" (program.subtitle <> '' AND " +" (program.subtitle = recorded.subtitle OR " +" (recorded.subtitle = '' AND " +" program.subtitle = recorded.description))) OR " +" (program.subtitle = '' AND program.description <> '' AND " +" (program.description = recorded.subtitle OR " +" (recorded.subtitle = '' AND " +" program.description = recorded.description)))) " " ) " " ) " " ) "