[mythtv] [PATCH] Updated Live TV override patch

steve at nexusuk.org steve at nexusuk.org
Mon Dec 22 13:09:24 EST 2003


Adds an option to let you set a priority for Live TV. Recordings lower 
than this priority won't interrupt your live TV viewing. You will also 
need to patch your theme so the scheduling conflicts screen will highlight 
the overridden recordings. At the moment the only patch available is for 
the Visor theme.

Bugs: Only the program's priority is taken into account, the channel and 
recording mode are ignored. Can anyone suggest a good way of getting the 
total priority including the channel and recording mode from inside 
libs/libmythtv/tv_rec.cpp?

MythTV patches available at:  http://www.nexusuk.org/projects/pvr/patches/

-- 

 - Steve                                             http://www.nexusuk.org/

     Servatis a periculum, servatis a maleficum - Whisper, Evanescence
-------------- next part --------------
diff -urN visor.vanilla/ui.xml visor.livetv_override/ui.xml
--- visor.vanilla/ui.xml	2003-12-17 19:38:44.000000000 +0000
+++ visor.livetv_override/ui.xml	2003-12-20 15:59:31.000000000 +0000
@@ -503,6 +503,12 @@
       <bold>yes</bold>
     </font>
 
+    <font name="livetvoverridefnt" face="Arial">
+      <color>#ff9999</color>
+      <size>16</size>
+      <bold>yes</bold>
+    </font>
+
     <font name="conflictfnt" face="Arial">
       <color>#ffff33</color>
       <size>16</size>
@@ -599,6 +605,11 @@
         <value lang="PT">Desactivadas</value>
         <value lang="SV">Deaktiverade</value>
       </textarea>
+      <textarea name="livetvred" draworder="0">
+        <area>425,330,300,40</area>
+        <font>livetvoverridefnt</font>
+        <value>LiveTV Override</value>
+      </textarea>
       <textarea name="showinstr" align="center" draworder="0">
         <area>0,570,800,30</area>
         <font>info</font>
@@ -615,7 +626,7 @@
     </container>
 
     <container name="showlevel_info">
-      <area>530,330,260,20</area>
+      <area>600,330,260,20</area>
       <textarea name="showing" draworder="4">
         <area>0,0,95,20</area>
         <font>message</font>
@@ -633,6 +644,7 @@
         <area>20,12,760,265</area>
         <fcnfont name="conflictfnt" function="conflictingrecording"></fcnfont>
         <fcnfont name="norecordfnt" function="disabledrecording"></fcnfont>
+        <fcnfont name="livetvoverridefnt" function="livetvoverriderecording"></fcnfont>
         <fcnfont name="active_font" function="active"></fcnfont>
         <fcnfont name="inactive_font" function="inactive"></fcnfont>
         <fcnfont name="active_font" function="selected"></fcnfont>
-------------- next part --------------
diff -urN mythtv-0.13.vanilla/libs/libmythtv/tv_rec.cpp mythtv-0.13.livetv_override/libs/libmythtv/tv_rec.cpp
--- mythtv-0.13.vanilla/libs/libmythtv/tv_rec.cpp	2003-11-12 08:45:47.000000000 +0000
+++ mythtv-0.13.livetv_override/libs/libmythtv/tv_rec.cpp	2003-12-20 15:37:15.000000000 +0000
@@ -201,6 +201,8 @@
         VERBOSE(VB_RECORD, "changing state finished, starting now");
     }
 
+    if ((internalState == kState_WatchingLiveTV) && gContext->GetNumSetting("RecPriorityActive") && gContext->GetNumSetting("RecPriorityLiveTVActive") && (rcinfo->recpriority.toInt() < gContext->GetNumSetting("LiveTVRecPriority"))) cancelNextRecording = true;
+
     if (internalState == kState_WatchingLiveTV && !cancelNextRecording)
     {
         QDateTime timeout;
@@ -849,7 +851,7 @@
 
         usleep(1000);
 
-        if (recordPending && askAllowRecording && frontendReady)
+        if (recordPending && askAllowRecording && frontendReady && ((! gContext->GetNumSetting("RecPriorityActive")) || (! gContext->GetNumSetting("RecPriorityLiveTVActive")) || (pendingRecording->recpriority.toInt() >= gContext->GetNumSetting("LiveTVRecPriority"))))
         {
             askAllowRecording = false;
 
diff -urN mythtv-0.13.vanilla/programs/mythfrontend/globalsettings.cpp mythtv-0.13.livetv_override/programs/mythfrontend/globalsettings.cpp
--- mythtv-0.13.vanilla/programs/mythfrontend/globalsettings.cpp	2003-12-10 21:35:46.000000000 +0000
+++ mythtv-0.13.livetv_override/programs/mythfrontend/globalsettings.cpp	2003-12-20 15:32:31.000000000 +0000
@@ -1118,6 +1118,28 @@
 
 // General RecPriorities settings
 
+class GRUseRecPrioritiesLiveTV: public CheckBoxSetting, public BackendSetting {
+public:
+    GRUseRecPrioritiesLiveTV():
+        BackendSetting("RecPriorityLiveTVActive") {
+        setLabel(QObject::tr("LiveTV Override"));
+        setHelpText(QObject::tr("Allow LiveTV to override recordings that have a "
+	            "low recording priority."));
+        setValue(false);
+    };
+};
+
+class GRLiveTVRecPriority: public SpinBoxSetting, public BackendSetting {
+public:
+    GRLiveTVRecPriority():
+        SpinBoxSetting(-99, 99, 1), BackendSetting("LiveTVRecPriority") {
+        setLabel(QObject::tr("LiveTV Priority"));
+        setHelpText(QObject::tr("If LiveTV Override is set then recordings with "
+	            "a priority value lower than this won't interrupt LiveTV."));
+        setValue(0);
+    };
+};
+
 class GRUseRecPriorities: public CheckBoxSetting, public BackendSetting {
 public:
     GRUseRecPriorities():
@@ -1512,6 +1534,8 @@
 
     gr->addChild(new GRUseRecPriorities());
     gr->addChild(new GRRecPrioritiesFirst());
+    gr->addChild(new GRUseRecPrioritiesLiveTV());
+    gr->addChild(new GRLiveTVRecPriority());
     gr->addChild(new GRSingleRecordRecPriority());
     gr->addChild(new GRWeekslotRecordRecPriority());
     gr->addChild(new GRTimeslotRecordRecPriority());
diff -urN mythtv-0.13.vanilla/programs/mythfrontend/viewscheduled.cpp mythtv-0.13.livetv_override/programs/mythfrontend/viewscheduled.cpp
--- mythtv-0.13.vanilla/programs/mythfrontend/viewscheduled.cpp	2003-12-06 00:01:45.000000000 +0000
+++ mythtv-0.13.livetv_override/programs/mythfrontend/viewscheduled.cpp	2003-12-20 15:20:24.000000000 +0000
@@ -350,6 +350,12 @@
                 if (i + skip == curRec)
                     ltype->SetItemCurrent(i);
 
+                if (gContext->GetNumSetting("RecPriorityActive") && gContext->GetNumSetting("RecPriorityLiveTVActive")) {
+		    if (p->recpriority.toInt() < gContext->GetNumSetting("LiveTVRecPriority")) {
+                        ltype->EnableForcedFont(i, "livetvoverriderecording");
+		    };
+		};
+
                 if (p->conflicting)
                     ltype->EnableForcedFont(i, "conflictingrecording");
                 else if (!p->recording)


More information about the mythtv-dev mailing list