Chris Pinkham wrote:
The RECORDING_LIST_CHANGE event is dispatched after the file is removed now,
so if it takes 10 seconds to delete the file, it will take a little more
than 10 seconds for the display to show it's been removed.  This is actually
showing you when it's removed from the database now, rather than the old
way of removing all info from the database whether the file could be removed
or not (or whether the file even existed or not).

Anyone have any input about Kevin's suggestion of changing the color of the
item on-screen?  Or are there any other ideas to show the user that the
recording is being deleted?  I didn't want to remove it from the screen,
only to have it pop back up if it couldn't be deleted, but I also find it
annoying to have to wait for the recording to be deleted.  That's why I've
made changes to the delete code in the past to move more things into the
delete thread rather than requiring the frontend to wait on them.

I already sent a patch for Isaac to take a look earlier today, didn't want to commit it this close to release. The patch prepends "**" to the title of deleted recordings, should provide at least enough feedback for the .17 release. It lets the backend's delete thread update the title in the db, before it starts deleting the file, that way playbackbox updates and shows the "**title", untill the backend is finished deleting it. It's fairly staight forward, other ways would require more complex changes due to the way recording lists are updated and displayed. It also delays rescheduling events after deleting something for about 20 seconds, that way the freed space should be taken into account. Patch is attached, suggestions and feedback welcome.

Holger

Index: mythtv/programs/mythbackend/mainserver.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/mainserver.cpp,v
retrieving revision 1.173
diff -u -p -r1.173 mainserver.cpp
--- mythtv/programs/mythbackend/mainserver.cpp	4 Feb 2005 03:53:16 -0000	1.173
+++ mythtv/programs/mythbackend/mainserver.cpp	5 Feb 2005 20:12:54 -0000
@@ -1031,6 +1031,36 @@ void MainServer::DoDeleteThread(DeleteSt
         return;
     }
 
+    QSqlQuery query(QString::null, delete_db->db());
+
+
+    // Prepend "**" to title so frontend has some user feedback
+    if (!ds->title.startsWith("**"))
+    {
+        QString newTitle = "**" + ds->title;
+        
+        query.prepare("UPDATE recorded SET title = :NEWTITLE "
+                      "WHERE chanid = :CHANID AND title = :TITLE "
+                      "AND starttime = :STARTTIME AND endtime = :ENDTIME;");
+        query.bindValue(":CHANID", ds->chanid);
+        query.bindValue(":TITLE", ds->title.utf8());
+        query.bindValue(":STARTTIME", ds->recstartts.toString("yyyyMMddhhmm00"));
+        query.bindValue(":ENDTIME", ds->recendts.toString("yyyyMMddhhmm00"));
+        query.bindValue(":NEWTITLE", newTitle.utf8());
+        query.exec();
+
+        if (query.isActive())
+        {
+            ds->title = newTitle;
+        }
+        else
+        {
+            MythContext::DBError("Prepend '**' to title error", query);
+        }
+
+    }
+
+
     JobQueue::DeleteAllJobs(delete_db->db(), ds->chanid, ds->recstartts);
 
     QString filename;
@@ -1071,7 +1101,6 @@ void MainServer::DoDeleteThread(DeleteSt
     }
     unlink(filename.ascii());
 
-    QSqlQuery query(QString::null, delete_db->db());
     query.prepare("DELETE FROM recorded WHERE chanid = :CHANID AND "
                   "title = :TITLE AND starttime = :STARTTIME AND "
                   "endtime = :ENDTIME;");
Index: mythtv/programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.192
diff -u -p -r1.192 playbackbox.cpp
--- mythtv/programs/mythfrontend/playbackbox.cpp	4 Feb 2005 19:57:57 -0000	1.192
+++ mythtv/programs/mythfrontend/playbackbox.cpp	5 Feb 2005 20:13:06 -0000
@@ -190,12 +190,15 @@ PlaybackBox::PlaybackBox(BoxType ltype, 
 
     nvp = NULL;
     timer = new QTimer(this);
+    schedulerNotifyTimer = new QTimer(this);
 
     updateBackground();
 
     setNoErase();
 
     connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
+    connect(schedulerNotifyTimer, SIGNAL(timeout()), 
+                     this, SLOT(schedulerNotifyTimeout()));
 
     timer->start(500);
     gContext->addListener(this);
@@ -1685,11 +1688,11 @@ void PlaybackBox::stop(ProgramInfo *rec)
 
 void PlaybackBox::doRemove(ProgramInfo *rec, bool forgetHistory)
 {
+    schedulerNotifyTimer->start(20000, true);
     RemoteDeleteRecording(rec, forgetHistory);
-    ScheduledRecording::signalChange(0);
-
+    usleep(500000); // give backend some time to update DB
+    
     connected = FillList();
-
     update(fullRect);
 }
 
@@ -2595,6 +2598,11 @@ void PlaybackBox::timeout(void)
     update(videoRect);
 }
 
+void PlaybackBox::schedulerNotifyTimeout(void)
+{
+    ScheduledRecording::signalChange(0);
+}
+
 void PlaybackBox::keyPressEvent(QKeyEvent *e)
 {
     bool handled = false;
Index: mythtv/programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.63
diff -u -p -r1.63 playbackbox.h
--- mythtv/programs/mythfrontend/playbackbox.h	28 Jan 2005 05:30:14 -0000	1.63
+++ mythtv/programs/mythfrontend/playbackbox.h	5 Feb 2005 20:13:07 -0000
@@ -101,6 +101,8 @@ class PlaybackBox : public MythDialog
     void togglePlayListItem(void);
     void playSelectedPlaylist(bool random);
     void doPlayList(void);
+    
+    void schedulerNotifyTimeout(void);    
   protected:
     void paintEvent(QPaintEvent *);
     void keyPressEvent(QKeyEvent *e);
@@ -272,6 +274,8 @@ class PlaybackBox : public MythDialog
 
     bool playingSomething;
     bool titleView;
+    
+    QTimer *schedulerNotifyTimer;
 };
 
 #endif
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to