Skip to content

Commit

Permalink
Slightly improve handling of failed recordings.
Browse files Browse the repository at this point in the history
Backport from master to fixes/0.24.

Improve the marking of failed recordings.  This should allow future
showings to be rescheduled when possible.  Based on a patch from
dl-mythtv%40catspoiler.org.
  • Loading branch information
gigem committed Feb 27, 2011
1 parent 057b017 commit 6e5ca62
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/tv_rec.cpp
Expand Up @@ -874,8 +874,10 @@ void TVRec::FinishedRecording(RecordingInfo *curRec)
VERBOSE(VB_RECORD, LOC + QString("FinishedRecording(%1) in recgroup: %2")
.arg(curRec->GetTitle()).arg(recgrp));

if (curRec->GetRecordingStatus() != rsFailed)
if (curRec->GetRecordingStatus() == rsRecording)
curRec->SetRecordingStatus(rsRecorded);
else if (curRec->GetRecordingStatus() != rsRecorded)
curRec->SetRecordingStatus(rsFailed);
curRec->SetRecordingEndTime(mythCurrentDateTime());

if (tvchain)
Expand Down
18 changes: 12 additions & 6 deletions mythtv/programs/mythbackend/mainserver.cpp
Expand Up @@ -2237,6 +2237,11 @@ void MainServer::DoHandleStopRecording(
if (pbs)
pbssock = pbs->getSocket();

if (recinfo.GetRecordingStatus() == rsRecording)
recinfo.SetRecordingStatus(rsRecorded);
else if (recinfo.GetRecordingStatus() != rsRecorded)
recinfo.SetRecordingStatus(rsFailed);

if (ismaster && recinfo.GetHostname() != gCoreContext->GetHostName())
{
PlaybackSock *slave = GetSlaveByHostname(recinfo.GetHostname());
Expand All @@ -2248,7 +2253,6 @@ void MainServer::DoHandleStopRecording(
if (num > 0)
{
(*encoderList)[num]->StopRecording();
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
Expand All @@ -2267,7 +2271,6 @@ void MainServer::DoHandleStopRecording(
// recording has stopped and the status should be updated.
// Continue so that the master can try to update the endtime
// of the file is in a shared directory.
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
Expand Down Expand Up @@ -2295,7 +2298,6 @@ void MainServer::DoHandleStopRecording(

if (ismaster)
{
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
Expand Down Expand Up @@ -2378,7 +2380,8 @@ void MainServer::DoHandleDeleteRecording(
{
recinfo.ApplyRecordRecGroupChange("Deleted");
recinfo.SaveAutoExpire(kDeletedAutoExpire, true);
if (recinfo.GetRecordingStatus() == rsRecording)
if (recinfo.GetRecordingStatus() == rsRecording ||
recinfo.GetRecordingStatus() == rsTuning)
DoHandleStopRecording(recinfo, NULL);
if (forgetHistory)
recinfo.ForgetHistory();
Expand All @@ -2387,6 +2390,11 @@ void MainServer::DoHandleDeleteRecording(
return;
}

if (recinfo.GetRecordingStatus() == rsRecording)
recinfo.SetRecordingStatus(rsRecorded);
else if (recinfo.GetRecordingStatus() != rsRecorded)
recinfo.SetRecordingStatus(rsFailed);

// If this recording was made by a another recorder, and that
// recorder is available, tell it to do the deletion.
if (ismaster && recinfo.GetHostname() != gCoreContext->GetHostName())
Expand All @@ -2400,7 +2408,6 @@ void MainServer::DoHandleDeleteRecording(
if (num > 0)
{
(*encoderList)[num]->StopRecording();
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
Expand Down Expand Up @@ -2441,7 +2448,6 @@ void MainServer::DoHandleDeleteRecording(

if (ismaster)
{
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
Expand Down

0 comments on commit 6e5ca62

Please sign in to comment.