Ticket #12081: 12081_possible_fix.diff
File 12081_possible_fix.diff, 5.2 KB (added by , 7 years ago) |
---|
-
mythtv/libs/libmyth/programinfo.cpp
commit 671795aa01dcf0689b06f64ffa362e27f0c0e3a1 Author: Stuart Morgan <smorgan@mythtv.org> Date: Thu Mar 27 17:35:03 2014 +0000 Fix some confusion over the behaviour/purpose of IsSameProgram Creates a new method similar to IsSameProgram called IsDuplicateProgram which is purely used for scheduling purposes. The issue seems to be that IsSameProgram() doesn't do what it appears it should. Places using it assume that it will match two programs which are identical - same content - but it's been modified over time to serve the definition of a 'duplicate' for scheduling purposes. This means, among other things, that if the duplicate check method is 'None', then IsSameProgram will return false given two identical programs. diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index 06cc019..a61317d 100644
a b bool ProgramInfo::IsSameProgramWeakCheck(const ProgramInfo &other) const 2051 2051 * \brief Checks for duplicates according to dupmethod. 2052 2052 * \param other ProgramInfo to compare this one with. 2053 2053 */ 2054 bool ProgramInfo::Is SameProgram(const ProgramInfo& other) const2054 bool ProgramInfo::IsDuplicateProgram(const ProgramInfo& other) const 2055 2055 { 2056 2056 if (GetRecordingRuleType() == kOneRecord) 2057 2057 return recordid == other.recordid; … … bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const 2115 2115 } 2116 2116 2117 2117 /** 2118 * \brief Checks whether this is the same program as "other", which may or may 2119 * not be a repeat or on another channel. Matches based on programid 2120 * with a fallback to dupmethod 2121 * \param other ProgramInfo to compare this one with. 2122 */ 2123 bool ProgramInfo::IsSameProgram(const ProgramInfo& other) const 2124 { 2125 if (title.compare(other.title, Qt::CaseInsensitive) != 0) 2126 return false; 2127 2128 if (!programid.isEmpty() && !other.programid.isEmpty()) 2129 { 2130 if (catType == kCategorySeries) 2131 { 2132 if (programid.endsWith("0000")) 2133 return false; 2134 } 2135 2136 if (usingProgIDAuth) 2137 { 2138 int index = programid.indexOf('/'); 2139 int oindex = other.programid.indexOf('/'); 2140 if (index == oindex && (index < 0 || 2141 programid.leftRef(index) == other.programid.leftRef(oindex))) 2142 return programid == other.programid; 2143 } 2144 else 2145 { 2146 return programid == other.programid; 2147 } 2148 } 2149 2150 if ((dupmethod & kDupCheckSub) && 2151 ((subtitle.isEmpty()) || 2152 (subtitle.compare(other.subtitle, Qt::CaseInsensitive) != 0))) 2153 return false; 2154 2155 if ((dupmethod & kDupCheckDesc) && 2156 ((description.isEmpty()) || 2157 (description.compare(other.description, Qt::CaseInsensitive) != 0))) 2158 return false; 2159 2160 if ((dupmethod & kDupCheckSubThenDesc) && 2161 ((subtitle.isEmpty() && 2162 ((!other.subtitle.isEmpty() && 2163 description.compare(other.subtitle, Qt::CaseInsensitive) != 0) || 2164 (other.subtitle.isEmpty() && 2165 description.compare(other.description, Qt::CaseInsensitive) != 0))) || 2166 (!subtitle.isEmpty() && 2167 ((other.subtitle.isEmpty() && 2168 subtitle.compare(other.description, Qt::CaseInsensitive) != 0) || 2169 (!other.subtitle.isEmpty() && 2170 subtitle.compare(other.subtitle, Qt::CaseInsensitive) != 0))))) 2171 return false; 2172 2173 return true; 2174 } 2175 2176 /** 2118 2177 * \brief Match same program, with same starttime (channel may be different) 2119 2178 * \param other ProgramInfo to compare this one with. 2120 2179 * \return true if this program is the same and shares same start time as "other" program. -
mythtv/libs/libmyth/programinfo.h
diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h index 161c34a..d2e2bee 100644
a b class MPUBLIC ProgramInfo 298 298 virtual void SubstituteMatches(QString &str); 299 299 300 300 // Used for scheduling recordings 301 bool IsSameProgram(const ProgramInfo &other) const; 301 bool IsSameProgram(const ProgramInfo &other) const; // Exact same program 302 bool IsDuplicateProgram(const ProgramInfo &other) const; // Is this program considered a duplicate according to rule type and dup method (scheduler only) 302 303 bool IsSameProgramAndStartTime(const ProgramInfo &other) const; // Exact same program and same starttime, Any channel 303 304 bool IsSameTitleStartTimeAndChannel(const ProgramInfo &other) const; // Same title, starttime and channel 304 305 bool IsSameTitleTimeslotAndChannel(const ProgramInfo &other) const;//sched only - Same title, starttime, endtime and channel -
mythtv/programs/mythbackend/scheduler.cpp
diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index 55ed297..e11487e 100644
a b bool Scheduler::IsSameProgram( 1024 1024 if (it != cache_is_same_program.end()) 1025 1025 return *it; 1026 1026 1027 return cache_is_same_program[X] = a->Is SameProgram(*b);1027 return cache_is_same_program[X] = a->IsDuplicateProgram(*b); 1028 1028 } 1029 1029 1030 1030 bool Scheduler::FindNextConflict(