[mythtv] patch - yes, delete, and also forget recording

Kirby Vandivort kvandivo at ks.uiuc.edu
Fri Dec 5 02:11:28 EST 2003


Sometimes Myth incorrectly records something.  This is virtually never
Myth's fault.  Usually, the game ran late, which pushed all the subsequent
shows back, or the station changed their schedule, or something..

In cases like that, it would be nice to be able to tell myth that you
want to delete the incorrect recording, and to go ahead and pick that
particular recording up again next time it is on so that you don't miss
that episode.

The following patch does this.  It modifies the delete popup box so that
it has another option that you can choose in this particular case.

In addition, from just glancing at the patch, it looks like the earlier
patch I had submitted (that adds the 'signalChange' to the forgetHistory
function) also slipped in on this one.

-- 

Kirby Vandivort                      Theoretical and 
Senior Research Programmer            Computational Biophysics 
Email: kvandivo at ks.uiuc.edu          3051 Beckman Institute
http://www.ks.uiuc.edu/~kvandivo/    University of Illinois
Phone: (217) 244-5711                405 N. Mathews Ave
Fax  : (217) 244-6078                Urbana, IL  61801, USA
-------------- next part --------------
Index: libs/libmythtv/remoteutil.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/remoteutil.cpp,v
retrieving revision 1.21
diff -b -u -2 -r1.21 remoteutil.cpp
--- libs/libmythtv/remoteutil.cpp	1 Dec 2003 20:17:55 -0000	1.21
+++ libs/libmythtv/remoteutil.cpp	5 Dec 2003 05:38:03 -0000
@@ -84,10 +84,20 @@
 }
 
-void RemoteDeleteRecording(ProgramInfo *pginfo)
+void RemoteDeleteRecording(ProgramInfo *pginfo, const int kiCorrect)
 {
-    QStringList strlist = QString("DELETE_RECORDING");
+    QStringList strlist;
+    strlist = QString("DELETE_RECORDING");
     pginfo->ToStringList(strlist);
 
     gContext->SendReceiveStringList(strlist);
+
+    if (kiCorrect == 0)
+    {
+        strlist = QString("FORGET_RECORDING");
+        pginfo->ToStringList(strlist);
+
+        gContext->SendReceiveStringList(strlist);
+    }
+
 }
 
Index: libs/libmythtv/remoteutil.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/remoteutil.h,v
retrieving revision 1.16
diff -b -u -2 -r1.16 remoteutil.h
--- libs/libmythtv/remoteutil.h	1 Nov 2003 18:08:35 -0000	1.16
+++ libs/libmythtv/remoteutil.h	5 Dec 2003 05:38:03 -0000
@@ -13,5 +13,5 @@
 void RemoteQueueTranscode(ProgramInfo *pginfo, int state);
 void RemoteStopRecording(ProgramInfo *pginfo);
-void RemoteDeleteRecording(ProgramInfo *pginfo);
+void RemoteDeleteRecording(ProgramInfo *pginfo, const int kiCorrect);
 bool RemoteGetAllPendingRecordings(vector<ProgramInfo *> &recordinglist);
 void RemoteGetAllScheduledRecordings(vector<ProgramInfo *> &scheduledlist);
Index: libs/libmythtv/scheduledrecording.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/scheduledrecording.cpp,v
retrieving revision 1.54
diff -b -u -2 -r1.54 scheduledrecording.cpp
--- libs/libmythtv/scheduledrecording.cpp	23 Nov 2003 15:57:37 -0000	1.54
+++ libs/libmythtv/scheduledrecording.cpp	5 Dec 2003 05:38:05 -0000
@@ -701,9 +701,13 @@
     QSqlQuery result = db->exec(query);
     if (!result.isActive())
+    {
         MythContext::DBError("doneRecording", result);
-
+    }
+    else
+    {
     // The addition of an entry to oldrecorded may affect near-future
     // scheduling decisions, so recalculate
     signalChange(db);
+    }
 }
 
@@ -724,5 +728,13 @@
     QSqlQuery result = db->exec(query);
     if (!result.isActive())
+    {
         MythContext::DBError("forgetHistory", result);
+    }
+    else
+    {
+        // The removal of an entry from oldrecorded may affect near-future
+        // scheduling decisions, so recalculate
+        signalChange(db);
+    }
 }
 
Index: programs/mythbackend/mainserver.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/mainserver.cpp,v
retrieving revision 1.100
diff -b -u -2 -r1.100 mainserver.cpp
--- programs/mythbackend/mainserver.cpp	5 Dec 2003 01:23:18 -0000	1.100
+++ programs/mythbackend/mainserver.cpp	5 Dec 2003 05:38:10 -0000
@@ -248,4 +248,8 @@
         HandleDeleteRecording(listline, pbs);
     }
+    else if (command == "FORGET_RECORDING")
+    {
+        HandleForgetRecording(listline, pbs);
+    }
     else if (command == "QUERY_GETALLPENDING")
     {
@@ -1131,4 +1135,30 @@
 }
 
+void MainServer::HandleForgetRecording(QStringList &slist, PlaybackSock *pbs)
+{
+    ProgramInfo *pginfo = new ProgramInfo();
+    pginfo->FromStringList(slist, 1);
+
+    DoHandleForgetRecording(pginfo, pbs);
+
+}
+
+void MainServer::DoHandleForgetRecording(ProgramInfo *pginfo, PlaybackSock *pbs)
+{
+    QSocket *pbssock = NULL;
+    if (pbs)
+        pbssock = pbs->getSocket();
+
+    pginfo->DeleteHistory(m_db);
+
+    if (pbssock)
+    {
+        QStringList outputlist = QString::number(0);
+        SendResponse(pbssock, outputlist);
+    }
+
+    delete pginfo;
+}
+
 void MainServer::getFreeSpace(int &totalspace, int &usedspace)
 {
Index: programs/mythbackend/mainserver.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/mainserver.h,v
retrieving revision 1.37
diff -b -u -2 -r1.37 mainserver.h
--- programs/mythbackend/mainserver.h	4 Dec 2003 21:49:35 -0000	1.37
+++ programs/mythbackend/mainserver.h	5 Dec 2003 05:38:10 -0000
@@ -60,4 +60,6 @@
     void HandleDeleteRecording(QStringList &slist, PlaybackSock *pbs);
     void DoHandleDeleteRecording(ProgramInfo *pginfo, PlaybackSock *pbs);
+    void HandleForgetRecording(QStringList &slist, PlaybackSock *pbs);
+    void DoHandleForgetRecording(ProgramInfo *pginfo, PlaybackSock *pbs);
     void HandleQueryFreeSpace(PlaybackSock *pbs);
     void HandleQueryCheckFile(QStringList &slist, PlaybackSock *pbs);
Index: programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.105
diff -b -u -2 -r1.105 playbackbox.cpp
--- programs/mythfrontend/playbackbox.cpp	2 Dec 2003 08:07:49 -0000	1.105
+++ programs/mythfrontend/playbackbox.cpp	5 Dec 2003 05:38:14 -0000
@@ -1308,5 +1308,5 @@
 }
 
-void PlaybackBox::doRemove(ProgramInfo *rec)
+void PlaybackBox::doRemove(ProgramInfo *rec, const int kiCorrect)
 {
     if (noUpdate)
@@ -1314,5 +1314,5 @@
 
     noUpdate = true;
-    RemoteDeleteRecording(rec);
+    RemoteDeleteRecording(rec, kiCorrect);
     noUpdate = false;
 
@@ -1445,8 +1445,17 @@
     const char *tmpslot;
 
+    if (types == 1 || types == 2)
+    {
+
+        tmpmessage = tr("Yes, wrong show recorded"); 
+        tmpslot = SLOT(doDeleteIncorrect());
+        popup->addButton(tmpmessage, this, tmpslot);
+    }
+
+
     switch (types)
     {
         case 1: case 2: tmpmessage = tr("Yes, get rid of it"); 
-                        tmpslot = SLOT(doDelete());
+                        tmpslot = SLOT(doDeleteCorrect());
                         break;
         case 3: tmpmessage = tr("Yes, AutoExpire"); 
@@ -1668,5 +1677,20 @@
 }
 
-void PlaybackBox::doDelete(void)
+void PlaybackBox::doDeleteCorrect()
+{
+    if (!expectingPopup)
+        return;
+
+    cancelPopup();
+
+    doRemove(delitem, 1);
+
+    delete delitem;
+    delitem = NULL;
+
+    timer->start(500);
+}
+
+void PlaybackBox::doDeleteIncorrect()
 {
     if (!expectingPopup)
@@ -1675,5 +1699,5 @@
     cancelPopup();
 
-    doRemove(delitem);
+    doRemove(delitem, 0);
 
     delete delitem;
Index: programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.34
diff -b -u -2 -r1.34 playbackbox.h
--- programs/mythfrontend/playbackbox.h	23 Nov 2003 17:40:02 -0000	1.34
+++ programs/mythfrontend/playbackbox.h	5 Dec 2003 05:38:14 -0000
@@ -55,5 +55,6 @@
 
     void askDelete();
-    void doDelete();
+    void doDeleteCorrect();
+    void doDeleteIncorrect();
     void noDelete();
 
@@ -114,5 +115,5 @@
     void startPlayer(ProgramInfo *rec);
 
-    void doRemove(ProgramInfo *);
+    void doRemove(ProgramInfo *, const int kiCorrect);
     void promptEndOfRecording(ProgramInfo *);
     void showDeletePopup(ProgramInfo *, int);


More information about the mythtv-dev mailing list