[mythtv] Live TV override

Steve Hill steve at nexusuk.org
Fri Aug 1 08:42:47 EDT 2003


I'm not a C++ coder (I use C normally) so this is probably not the best 
bit of code.

This is a hack allow you to set a rank to apply to LiveTV (set up in the 
rankings settings).  Recordings below that rank will be automatically 
cancelled if you are watching live TV.  I.e.  you can set Myth to record 
every episode of The Simpsons but not when you're already watching 
something else.

Comments would be appreciated.

At the moment this only looks at the program rank, not the channel and 
recording type ranks (what's the best way of actually finding the total 
rank for a program?).  Programs that will be overridden by LiveTV will 
appear red in the conflicts screen (I've patched the Visor theme so far.  
I haven't gotten around to patching the Blue theme)

-- 

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

        *** Presented in DoubleVision (Where Drunk) - Futurama ***

-------------- next part --------------
diff -urN visor/ui.xml visor.lowrank/ui.xml
--- visor/ui.xml	2003-07-04 03:23:08.000000000 +0100
+++ visor.lowrank/ui.xml	2003-07-30 22:31:14.000000000 +0100
@@ -403,6 +403,12 @@
       <bold>yes</bold>
     </font>
 
+    <font name="lowrankfnt" face="Arial">
+      <color>#ff9999</color>
+      <size>16</size>
+      <bold>yes</bold>
+    </font>
+
     <font name="conflictfnt" face="Arial">
       <color>#ffff33</color>
       <size>16</size>
@@ -515,6 +521,7 @@
       <area>0,39,800,310</area>
       <listarea name="conflictlist" draworder="4">
         <area>20,12,760,265</area>
+        <fcnfont name="lowrankfnt" function="lowrankrecording"></fcnfont>
         <fcnfont name="conflictfnt" function="conflictingrecording"></fcnfont>
         <fcnfont name="norecordfnt" function="disabledrecording"></fcnfont>
         <fcnfont name="active_font" function="active"></fcnfont>
-------------- next part --------------
? mythtv/i18n/.qmake.internal.cache
? mythtv/libs/libavformat/.qmake.internal.cache
? mythtv/libs/libdvbdev/.qmake.internal.cache
? mythtv/libs/libvbitext/.qmake.internal.cache
? mythtv/programs/mythlcd/.qmake.internal.cache
? mythtv/programs/mythprogfind/.qmake.internal.cache
Index: mythtv/libs/libmythtv/tv_rec.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_rec.cpp,v
retrieving revision 1.97
diff -u -r1.97 tv_rec.cpp
--- mythtv/libs/libmythtv/tv_rec.cpp	23 Jul 2003 16:01:42 -0000	1.97
+++ mythtv/libs/libmythtv/tv_rec.cpp	1 Aug 2003 06:32:52 -0000
@@ -189,6 +189,8 @@
         VERBOSE("changing state finished, starting now");
     }
 
+    if ((internalState == kState_WatchingLiveTV) && gContext->GetNumSetting("RankingActive") && gContext->GetNumSetting("LiveTVRankActive") && (rcinfo->rank.toInt() < gContext->GetNumSetting("LiveTVRank"))) cancelNextRecording = true;
+
     if (internalState == kState_WatchingLiveTV && !cancelNextRecording)
     {
         QDateTime timeout;
@@ -791,8 +793,7 @@
 
         usleep(1000);
 
-        if (recordPending && askAllowRecording && frontendReady)
-        {
+        if (recordPending && askAllowRecording && frontendReady && ((! gContext->GetNumSetting("RankingActive")) || (! gContext->GetNumSetting("LiveTVRankActive")) || (pendingRecording->rank.toInt() >= gContext->GetNumSetting("LiveTVRank")))) {
             askAllowRecording = false;
 
             int timeuntil = QDateTime::currentDateTime()
Index: mythtv/programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.85
diff -u -r1.85 globalsettings.cpp
--- mythtv/programs/mythfrontend/globalsettings.cpp	28 Jul 2003 15:10:48 -0000	1.85
+++ mythtv/programs/mythfrontend/globalsettings.cpp	1 Aug 2003 06:32:53 -0000
@@ -894,6 +894,28 @@
 
 // General Ranking settings
 
+class GRUseLiveTVRanking: public CheckBoxSetting, public BackendSetting {
+public:
+    GRUseLiveTVRanking():
+        BackendSetting("LiveTVRankActive") {
+        setLabel("LiveTV Override");
+        setHelpText("Allow LiveTV to override recordings that have a low ranking.");
+        setValue(false);
+    };
+};
+
+class GRLiveTVRank: public SpinBoxSetting, public BackendSetting {
+public:
+    GRLiveTVRank():
+        SpinBoxSetting(-99, 99, 1), BackendSetting("LiveTVRank") {
+        setLabel("LiveTV Rank");
+        setHelpText("If LiveTV Override is set then recordings with "
+                    "a ranking value lower than this won't interrupt."
+		    "LiveTV.");
+        setValue(0);
+    };
+};
+
 class GRUseRanking: public CheckBoxSetting, public BackendSetting {
 public:
     GRUseRanking():
@@ -1155,6 +1177,8 @@
 
     gr->addChild(new GRUseRanking());
     gr->addChild(new GRRankingFirst());
+    gr->addChild(new GRUseLiveTVRanking());
+    gr->addChild(new GRLiveTVRank());
     gr->addChild(new GRSingleRecordRank());
     gr->addChild(new GRWeekslotRecordRank());
     gr->addChild(new GRTimeslotRecordRank());
Index: mythtv/programs/mythfrontend/viewscheduled.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/viewscheduled.cpp,v
retrieving revision 1.60
diff -u -r1.60 viewscheduled.cpp
--- mythtv/programs/mythfrontend/viewscheduled.cpp	19 Jul 2003 20:10:41 -0000	1.60
+++ mythtv/programs/mythfrontend/viewscheduled.cpp	1 Aug 2003 06:32:54 -0000
@@ -459,6 +459,12 @@
                         ltype->SetItemText(cnt, 2, tempDate + " " + tempTime);
                         ltype->SetItemText(cnt, 3, tempSubTitle);
 
+                        if (gContext->GetNumSetting("RankingActive") && gContext->GetNumSetting("LiveTVRankActive")) {
+				if (tempInfo->rank.toInt() < gContext->GetNumSetting("LiveTVRank")) {
+	                            ltype->EnableForcedFont(cnt, "lowrankrecording");
+				};
+			};
+			
                         if (tempInfo->conflicting)
                         {
                             ltype->EnableForcedFont(cnt, 


More information about the mythtv-dev mailing list