Skip to content

Commit

Permalink
Don't always delete active recordings from previously recorded.
Browse files Browse the repository at this point in the history
When deleting a series from the previously recorded screen, don't
delete entries for programs that are currently recording.  This allows
them to be restarted if the backend dies unexpectedly.  Deleting
single entries is still allowed on the premise the user knows what
they are doing.
  • Loading branch information
gigem committed Jun 7, 2020
1 parent 118db4d commit b8b2690
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mythtv/programs/mythfrontend/prevreclist.cpp
Expand Up @@ -777,8 +777,17 @@ void PrevRecordedList::DeleteOldSeries(bool ok)

MSqlQuery query(MSqlQuery::InitCon());
query.prepare("DELETE FROM oldrecorded "
"WHERE title = :TITLE AND future = 0");
"WHERE title = :TITLE "
" AND recstatus <> :PENDING "
" AND recstatus <> :TUNING "
" AND recstatus <> :RECORDING "
" AND recstatus <> :FAILING "
" AND future = 0");
query.bindValue(":TITLE", title);
query.bindValue(":PENDING", RecStatus::Pending);
query.bindValue(":TUNING", RecStatus::Tuning);
query.bindValue(":RECORDING", RecStatus::Recording);
query.bindValue(":FAILING", RecStatus::Failing);
if (!query.exec())
MythDB::DBError("ProgLister::DeleteOldSeries -- delete", query);

Expand All @@ -793,7 +802,11 @@ void PrevRecordedList::DeleteOldSeries(bool ok)
auto it = m_showData.begin();
while (pos < (int)m_showData.size())
{
if ((*it)->GetTitle() == title)
if ((*it)->GetTitle() == title
&& (*it)->GetRecordingStatus() != RecStatus::Pending
&& (*it)->GetRecordingStatus() != RecStatus::Tuning
&& (*it)->GetRecordingStatus() != RecStatus::Recording
&& (*it)->GetRecordingStatus() != RecStatus::Failing)
{
LOG(VB_GENERAL, LOG_INFO, QString("Deleting %1 at pos %2")
.arg(title).arg(pos));
Expand Down

0 comments on commit b8b2690

Please sign in to comment.