[mythtv] [PATCH] OnePowerSearch -- a onetime power search

Brad Templeton brad+mydev at templetons.com
Sat Jan 29 15:19:54 EST 2005


Below is a patch which implements a "one time" power search.  Effectively
identical to the existing PowerSearch, but, like a FindOne, it is deleted
after the first successful recording. 

I am using this in wishtv to be able to request a specific-episode FindOne
functionality -- I want to see this specific episode of a show any time
it is on.

Unusually, I have deliberatley not given a UI for users to create one 
in Mythfrontend for two reasons:
    
    a) My hope is always to simplify UIs, not to complicate them
    b) I would prefer getting input from others on what UI to have if
       there is to be one.  UIs could include simply adding "Record Once"
       to the menu of choices for a power search and SQL search, or
       indeed adding this ability to all searches (which would mean
       making one-time-ness an flag rather than an enumerated attribute
       of the search)

Also, a new version of wishtv is available:
        http://www.templetons.com/brad/myth/wishtv.html

        http://www.templetons.com/brad/myth/wishtv.tar

Improvements include fixing a bug that blocked movie wishlists,
Ability to list the things you don't want (ie. record every episode of
this show except for the following ones)  and partial implementation of
a web cache to make remotely fetched live critic's lists more efficient
for everybody.  (You won't want an eventual million mythboxes pounding on
your web site every hour for updates on recommended shows.)

Oh yeah -- I need to detect if the user's mythbackend has this function,
so for now I will wait for somebody else to increase the database schema
number for another reason that actually changes the format of the db.



Index: libs/libmythtv/recordingtypes.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/recordingtypes.h,v
retrieving revision 1.3
diff -u -r1.3 recordingtypes.h
--- libs/libmythtv/recordingtypes.h	19 Jan 2005 23:10:18 -0000	1.3
+++ libs/libmythtv/recordingtypes.h	29 Jan 2005 20:04:53 -0000
@@ -42,7 +42,8 @@
     kPowerSearch,
     kTitleSearch,
     kKeywordSearch,
-    kPeopleSearch
+    kPeopleSearch,
+    kOnePowerSearch     // Onetime power search
 };
 
 #endif
Index: libs/libmythtv/scheduledrecording.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/scheduledrecording.cpp,v
retrieving revision 1.129
diff -u -r1.129 scheduledrecording.cpp
--- libs/libmythtv/scheduledrecording.cpp	27 Jan 2005 09:37:20 -0000	1.129
+++ libs/libmythtv/scheduledrecording.cpp	29 Jan 2005 20:04:53 -0000
@@ -140,6 +140,9 @@
         case kPowerSearch:
             searchType = "(" +  QObject::tr("Power Search") + ")";
             break;
+        case kOnePowerSearch:
+            searchType = "(" +  QObject::tr("Power Search Once") + ")";
+            break;
         case kTitleSearch:
             searchType = "(" +  QObject::tr("Title Search") + ")";
             break;
@@ -420,7 +423,10 @@
 void ScheduledRecording::doneRecording(QSqlDatabase* db, 
                                        const ProgramInfo& proginfo) 
 {
-    if (getRecordingType() == kFindOneRecord)
+    // We delete FindOne recordings and one-time power searches after
+    // the first one successfully records
+    if (getRecordingType() == kFindOneRecord ||
+            getSearchType() == kOnePowerSearch )
         remove(db);
 
     QString msg;
@@ -528,6 +534,7 @@
                                 gContext->GetMainWindow(), "proglist");
             break;
         case kPowerSearch:
+        case kOnePowerSearch:
             pl = new ProgLister(plSQLSearch, rule.description->getValue(),
                                 QSqlDatabase::database(),
                                 gContext->GetMainWindow(), "proglist");
Index: programs/mythbackend/scheduler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/scheduler.cpp,v
retrieving revision 1.128
diff -u -r1.128 scheduler.cpp
--- programs/mythbackend/scheduler.cpp	28 Jan 2005 04:06:31 -0000	1.128
+++ programs/mythbackend/scheduler.cpp	29 Jan 2005 20:04:54 -0000
@@ -1288,6 +1288,7 @@
         switch (result.value(1).toInt())
         {
         case kPowerSearch:
+        case kOnePowerSearch:
             from << result.value(2).toString();
             where << QString("record.recordid = %1 %2")
                 .arg(result.value(0).toString())


More information about the mythtv-dev mailing list