[mythtv-users] [PATCH] Added Recording "Under" Time to enable to start recordings early

Tako Schotanus quintesse at palacio-cristal.com
Sun Jun 29 17:31:31 EDT 2003


Skipped content of type multipart/alternative-------------- next part --------------
? preroll.patch
Index: programs/mythbackend/scheduler.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythbackend/scheduler.cpp,v
retrieving revision 1.28
diff -b -u -2 -r1.28 scheduler.cpp
--- programs/mythbackend/scheduler.cpp	27 Jun 2003 00:36:22 -0000	1.28
+++ programs/mythbackend/scheduler.cpp	28 Jun 2003 15:47:36 -0000
@@ -1009,4 +1009,8 @@
         }
 
+        // Determine if the user wants us to start recording early
+        // and by how many seconds
+        int prerollseconds = gContext->GetNumSetting("RecordPreRoll");
+
         recIter = recordingList.begin();
         while (recIter != recordingList.end())
@@ -1014,14 +1018,5 @@
             nextRecording = (*recIter);
 
-            nextrectime = nextRecording->startts;
-            secsleft = curtime.secsTo(nextrectime);
-
-            bool recording = nextRecording->recording;
-
-//            VERBOSE(secsleft << " seconds until " << nextRecording->title);
-
-            if (secsleft > 35)
-                break;
-
+            // Determine the card we're going to use for recording
             if (m_tvList->find(nextRecording->cardid) == m_tvList->end())
             {
@@ -1033,7 +1028,26 @@
             // cerr << " title: " << nextRecording->title << endl;
 
+            bool recording = nextRecording->recording;
+
+            // Determine the number of seconds left to the start of the program
+            nextrectime = nextRecording->startts;
+            secsleft = curtime.secsTo(nextrectime);
+            if (recording && !nexttv->isBusy())
+            {
+                // Will use pre-roll settings only if no other
+                // program is currently being recorded
+                secsleft -= prerollseconds;
+            }
+
+//            VERBOSE(secsleft << " seconds until " << nextRecording->title);
+
+            if (secsleft > 35)
+                break;
+
+            // Check if the user is using the card to watch life TV
             if (recording && nexttv->GetState() == kState_WatchingLiveTV &&
                 secsleft <= 30 && secsleft > 0)
             {
+                // If so ask for permission to take over the card
                 QString id = nextRecording->schedulerid; 
                 if (askedList.contains(id) && askedList[id] == false)
@@ -1045,9 +1059,12 @@
             }
 
+            // Check if time is up and we're supposed to be recording
             if (recording && secsleft <= -2)
             {
+                // Did the user approve us taking over the card?
                 if (responseList.contains(nextRecording->schedulerid) &&
                     responseList[nextRecording->schedulerid] == false)
                 {
+                    // If not we keep waiting
                     VERBOSE("Waiting for \"" << nextRecording->title 
                     << "\" to be approved.");
@@ -1055,4 +1072,5 @@
                 else
                 {
+                    // If so we start recording
                     nexttv->StartRecording(nextRecording);
                     VERBOSE("Started recording \"" << nextRecording->title 
@@ -1068,6 +1086,8 @@
             }
  
+            // Check if time is up and the scheduled recording was deactivated
             if (!recording && secsleft <= -2)
             {
+                // If so we remove it
                 AddToDontRecord(nextRecording);
                 RemoveRecording(nextRecording);
Index: programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.74
diff -b -u -2 -r1.74 globalsettings.cpp
--- programs/mythfrontend/globalsettings.cpp	27 Jun 2003 23:12:43 -0000	1.74
+++ programs/mythfrontend/globalsettings.cpp	28 Jun 2003 15:47:38 -0000
@@ -214,4 +214,14 @@
 };
 
+class RecordPreRoll: public SpinBoxSetting, public GlobalSetting {
+public:
+    RecordPreRoll():
+        SpinBoxSetting(0, 600, 1),
+        GlobalSetting("RecordPreRoll") {
+        setLabel("Time to record before start of show (in seconds)");
+        setValue(0);
+    };
+};
+
 class RecordOverTime: public SpinBoxSetting, public GlobalSetting {
 public:
@@ -919,4 +929,5 @@
     VerticalConfigurationGroup* general = new VerticalConfigurationGroup(false);
     general->setLabel("General");
+    general->addChild(new RecordPreRoll());
     general->addChild(new RecordOverTime());
     general->addChild(new PlayBoxOrdering());


More information about the mythtv-users mailing list