From 4ce7cd8cbb892390e8d389462ccba716c6e6acf4 Mon Sep 17 00:00:00 2001 From: David Engel Date: Sat, 19 Mar 2011 11:01:00 -0500 Subject: [PATCH] Fix history handling of overridden find recordings. Cherry-picked f53bb2b3 from master. When manipulating the history for find recordings that are overridden, use the parent recordid instead of the recordid. This fixes a problem where non-overridden shows aren't considered as previously recorded. --- mythtv/libs/libmythtv/recordinginfo.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mythtv/libs/libmythtv/recordinginfo.cpp b/mythtv/libs/libmythtv/recordinginfo.cpp index 7c973e9bd9a..aae62e4f82b 100644 --- a/mythtv/libs/libmythtv/recordinginfo.cpp +++ b/mythtv/libs/libmythtv/recordinginfo.cpp @@ -1125,6 +1125,7 @@ void RecordingInfo::AddHistory(bool resched, bool forcedup) oldrecstatus = GetRecordingStatus(); if (dup) SetReactivated(false); + uint erecid = parentid ? parentid : recordid; MSqlQuery result(MSqlQuery::InitCon()); @@ -1145,7 +1146,7 @@ void RecordingInfo::AddHistory(bool resched, bool forcedup) result.bindValue(":SERIESID", seriesid); result.bindValue(":PROGRAMID", programid); result.bindValue(":FINDID", findid); - result.bindValue(":RECORDID", recordid); + result.bindValue(":RECORDID", erecid); result.bindValue(":STATION", chansign); result.bindValue(":RECTYPE", rectype); result.bindValue(":RECSTATUS", rs); @@ -1159,7 +1160,7 @@ void RecordingInfo::AddHistory(bool resched, bool forcedup) { result.prepare("REPLACE INTO oldfind (recordid, findid) " "VALUES(:RECORDID,:FINDID);"); - result.bindValue(":RECORDID", recordid); + result.bindValue(":RECORDID", erecid); result.bindValue(":FINDID", findid); if (!result.exec()) @@ -1177,6 +1178,8 @@ void RecordingInfo::AddHistory(bool resched, bool forcedup) */ void RecordingInfo::DeleteHistory(void) { + uint erecid = parentid ? parentid : recordid; + MSqlQuery result(MSqlQuery::InitCon()); result.prepare("DELETE FROM oldrecorded WHERE title = :TITLE AND " @@ -1192,7 +1195,7 @@ void RecordingInfo::DeleteHistory(void) { result.prepare("DELETE FROM oldfind WHERE " "recordid = :RECORDID AND findid = :FINDID"); - result.bindValue(":RECORDID", recordid); + result.bindValue(":RECORDID", erecid); result.bindValue(":FINDID", findid); if (!result.exec()) @@ -1214,6 +1217,8 @@ void RecordingInfo::DeleteHistory(void) */ void RecordingInfo::ForgetHistory(void) { + uint erecid = parentid ? parentid : recordid; + MSqlQuery result(MSqlQuery::InitCon()); result.prepare("UPDATE recorded SET duplicate = 0 " @@ -1254,7 +1259,7 @@ void RecordingInfo::ForgetHistory(void) { result.prepare("DELETE FROM oldfind WHERE " "recordid = :RECORDID AND findid = :FINDID"); - result.bindValue(":RECORDID", recordid); + result.bindValue(":RECORDID", erecid); result.bindValue(":FINDID", findid); if (!result.exec())