Skip to content
Permalink
Browse files

Slightly improve handling of failed recordings.

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 739a807 commit 38f8fb1f2b38ba481cf7299ce2f56fe7297e5838
Showing with 15 additions and 7 deletions.
  1. +3 −1 mythtv/libs/libmythtv/tv_rec.cpp
  2. +12 −6 mythtv/programs/mythbackend/mainserver.cpp
@@ -870,8 +870,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)
@@ -2267,6 +2267,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());
@@ -2278,7 +2283,6 @@ void MainServer::DoHandleStopRecording(
if (num > 0)
{
(*encoderList)[num]->StopRecording();
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
@@ -2297,7 +2301,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);
}
@@ -2325,7 +2328,6 @@ void MainServer::DoHandleStopRecording(

if (ismaster)
{
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
@@ -2408,7 +2410,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();
@@ -2417,6 +2420,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())
@@ -2430,7 +2438,6 @@ void MainServer::DoHandleDeleteRecording(
if (num > 0)
{
(*encoderList)[num]->StopRecording();
recinfo.SetRecordingStatus(rsRecorded);
if (m_sched)
m_sched->UpdateRecStatus(&recinfo);
}
@@ -2471,7 +2478,6 @@ void MainServer::DoHandleDeleteRecording(

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

0 comments on commit 38f8fb1

Please sign in to comment.
You can’t perform that action at this time.