Skip to content

Commit

Permalink
Fix history handling of overridden find recordings.
Browse files Browse the repository at this point in the history
Cherry-picked f53bb2b 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.
  • Loading branch information
gigem committed Mar 19, 2011
1 parent ccd73be commit 4ce7cd8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mythtv/libs/libmythtv/recordinginfo.cpp
Expand Up @@ -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());

Expand All @@ -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);
Expand All @@ -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())
Expand All @@ -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 "
Expand All @@ -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())
Expand All @@ -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 "
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 4ce7cd8

Please sign in to comment.