After a bit of discussion/statements on -users I came up with the
following patch which :

Allows you to scan for radio services.
Allows the EIT guide to work for radio services.

What it doesn't do is allow you to play back the said recording. If
anyone feels like doing this bit, that would be cool :)

--
John
Index: dbcheck.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dbcheck.cpp,v
retrieving revision 1.85
diff -u -r1.85 dbcheck.cpp
--- dbcheck.cpp	9 Feb 2005 21:35:13 -0000	1.85
+++ dbcheck.cpp	17 Feb 2005 22:29:33 -0000
@@ -9,7 +9,7 @@
 #include "mythcontext.h"
 #include "mythdbcon.h"
 
-const QString currentDatabaseVersion = "1071";
+const QString currentDatabaseVersion = "1072";
 
 static bool UpdateDBVersionNumber(const QString &newnumber);
 static bool performActualUpdate(const QString updates[], QString version,
@@ -1398,6 +1398,15 @@
         if (!performActualUpdate(updates, "1071", dbver))
             return false;
     }
+    if (dbver == "1071")
+    {
+        const QString updates[] = {
+"ALTER TABLE cardinput ADD COLUMN radioservices TINYINT(1) DEFAULT 1;",
+""
+};
+        if (!performActualUpdate(updates, "1072", dbver))
+            return false;
+    }
 
     return true;
 }
Index: dvbchannel.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbchannel.cpp,v
retrieving revision 1.31
diff -u -r1.31 dvbchannel.cpp
--- dvbchannel.cpp	6 Feb 2005 18:15:30 -0000	1.31
+++ dvbchannel.cpp	17 Feb 2005 22:29:34 -0000
@@ -247,7 +247,7 @@
 
     GENERAL(QString("Successfully tuned to channel %1.").arg(chan));
 
-    if (!chan_opts.pmt.OnAir())
+    if (!chan_opts.pmt.OnAir() && !chan_opts.pmt.RadioService())
     {
         ERROR(QString("Channel #%1 is off air.").arg(chan));
         return false;
Index: scanwizard.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/scanwizard.cpp,v
retrieving revision 1.3
diff -u -r1.3 scanwizard.cpp
--- scanwizard.cpp	6 Feb 2005 18:15:30 -0000	1.3
+++ scanwizard.cpp	17 Feb 2005 22:29:36 -0000
@@ -967,7 +967,8 @@
     scanner = new SIScan(dvbchannel,db,&db_lock,parent->videoSource());
     
     scanner->SetForceUpdate(true);
-    QString thequery = QString("SELECT freetoaironly FROM cardinput "
+    QString thequery = QString("SELECT freetoaironly,radioservices FROM "
+                               "cardinput "
                                "WHERE cardinput.cardid=%1 AND "
                                "cardinput.sourceid=%2")
                                .arg(parent->captureCard())
@@ -976,13 +977,16 @@
     pthread_mutex_lock(&db_lock);
     QSqlQuery query = db->exec(thequery);
     bool freetoair = true;
+    bool radio = true;
     if (query.isActive() && query.numRowsAffected() > 0)
     {
         query.next();
         freetoair=query.value(0).toBool();
+        radio=query.value(1).toBool();
     }
     pthread_mutex_unlock(&db_lock);
     scanner->SetFTAOnly(freetoair);
+    scanner->SetRadioServices(radio);
 
     connect(scanner,SIGNAL(ServiceScanComplete(void)),
             this,SLOT(scanComplete(void)));
Index: siparser.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/siparser.cpp,v
retrieving revision 1.6
diff -u -r1.6 siparser.cpp
--- siparser.cpp	15 Feb 2005 16:33:08 -0000	1.6
+++ siparser.cpp	17 Feb 2005 22:29:38 -0000
@@ -1149,7 +1149,8 @@
         bool eit_requested = false;
 #ifdef USING_DVB_EIT
 
-        if ((s.EITPresent) && (s.ServiceType == 1) && ((!PrivateTypes.GuideOnSingleTransport) ||
+        if ((s.EITPresent) && ((s.ServiceType==1) || (s.ServiceType==2)) && 
+            ((!PrivateTypes.GuideOnSingleTransport) ||
             ((PrivateTypes.GuideOnSingleTransport) && 
             (PrivateTypes.GuideTransportID == PrivateTypes.CurrentTransportID)))) 
         {
Index: siscan.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/siscan.cpp,v
retrieving revision 1.6
diff -u -r1.6 siscan.cpp
--- siscan.cpp	9 Feb 2005 21:35:13 -0000	1.6
+++ siscan.cpp	17 Feb 2005 22:29:40 -0000
@@ -31,6 +31,7 @@
     ScanTimeout = 0; 		/* Set scan timeout off by default */
 
     FTAOnly = false;
+    RadioServices = false;
     forceUpdate = false;
 
     pthread_mutex_init(&events_lock, NULL);
@@ -158,6 +159,7 @@
                 if (fAll)
                     emit ServiceScanComplete();
 */
+                emit PctServiceScanComplete(((transportsToScan-transportsCount)*100)/transportsToScan);
                 sourceIDTransportTuned = false;
             }
             else
@@ -183,12 +185,6 @@
 
         if (scanMode == TRANSPORT_LIST)
         {
-            if (transportsCount == 0)
-            {
-                emit PctServiceScanComplete(100);
-                emit ServiceScanComplete();
-                scanMode = IDLE; 
-            }
             if ((!sourceIDTransportTuned) || ((ScanTimeout > 0) && (timer.elapsed() > ScanTimeout)))
             {
                 QValueList<TransportScanList>::Iterator i;
@@ -203,8 +199,9 @@
                         emit ServiceScanUpdateText((*i).FriendlyName);
                         SISCAN(QString("Tuning to mplexid %1").arg((*i).mplexid));
                         transportsCount--;
-                        emit PctServiceScanComplete(((transportsToScan-transportsCount-1)*100)/transportsToScan);
-         
+                        if (transportsCount == 0)
+                            scanMode = IDLE; 
+
                         bool result = false;                
                         if ((*i).mplexid == -1)
                         {
@@ -216,9 +213,13 @@
                         }
                         else 
                             result = chan->SetTransportByInt((*i).mplexid);
-
+        
                         if (!result)
+                        {
+                            int pct = ((transportsToScan-transportsCount)*100)/transportsToScan;
+                            emit PctServiceScanComplete(pct);
                             emit ServiceScanUpdateText("Failed to tune");
+                        }
                         else
                         {
                             if ((*i).mplexid == -1)
@@ -475,7 +476,7 @@
 
 // Get the freetoaironly field from cardinput 
 
-    QString FTAQuery = QString("SELECT freetoaironly from cardinput,dtv_multiplex, "
+    QString FTAQuery = QString("SELECT freetoaironly,radioservices from cardinput,dtv_multiplex, "
                                "capturecard WHERE "
                                "cardinput.sourceid = dtv_multiplex.sourceid AND "
                                "cardinput.cardid = capturecard.cardid AND "
@@ -492,7 +493,8 @@
     if (query.numRowsAffected() > 0)
     {
         query.next();
-        FTAOnly = query.value(0).toInt();
+        FTAOnly = query.value(0).toBool();
+        RadioServices = query.value(1).toBool();
     }
     else
     {
@@ -504,7 +506,7 @@
     for (s = SDT.begin() ; s != SDT.end() ; ++s )
     {
         // Its a TV Service so add it also only do FTA
-        if(((*s).ServiceType == 1) &&
+        if((((*s).ServiceType==1) || ((*s).ServiceType==2) && RadioServices) &&
            (!FTAOnly || (FTAOnly && ((*s).CAStatus == 0))))
         {
             // See if transport already in database based on serviceid,networkid  and transportid
Index: siscan.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/siscan.h,v
retrieving revision 1.2
diff -u -r1.2 siscan.h
--- siscan.h	6 Feb 2005 18:15:30 -0000	1.2
+++ siscan.h	17 Feb 2005 22:29:40 -0000
@@ -62,6 +62,7 @@
     void SetSourceID(int _SourceID);
 
     void SetFTAOnly(bool _fFTAOnly) { FTAOnly = _fFTAOnly;}
+    void SetRadioServices(bool _fRadio) { RadioServices = _fRadio;}
     void SetForceUpdate(bool _force) { forceUpdate = _force;}
     void SetScanTimeout(int _timeout) { ScanTimeout = _timeout;}
 
@@ -116,6 +117,7 @@
 
     bool threadExit;
     bool FTAOnly;
+    bool RadioServices;
     bool forceUpdate;
     int ScanTimeout;
     SCANMODE scanMode;
Index: sitypes.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/sitypes.h,v
retrieving revision 1.3
diff -u -r1.3 sitypes.h
--- sitypes.h	31 Jan 2005 05:49:56 -0000	1.3
+++ sitypes.h	17 Feb 2005 22:29:40 -0000
@@ -406,6 +406,7 @@
     PMTObject() { Reset(); }
     void Reset();
 
+    bool RadioService() { return hasAudio; }
     bool TelevisionService() { return hasVideo && hasAudio; }
     bool OnAir() { return TelevisionService(); }
     bool FTA() { return !hasCA; }
Index: videosource.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videosource.cpp,v
retrieving revision 1.66
diff -u -r1.66 videosource.cpp
--- videosource.cpp	11 Feb 2005 19:06:14 -0000	1.66
+++ videosource.cpp	17 Feb 2005 22:29:43 -0000
@@ -1189,6 +1189,17 @@
     };
 };
 
+class RadioServices: public CheckBoxSetting, public CISetting {
+public:
+    RadioServices(const CardInput& parent):
+        CISetting(parent, "radioservices")
+    {
+        setValue(true);
+        setLabel(QObject::tr("Radio channels."));
+        setHelpText(QObject::tr("If set, radio channel will also be included.")); 
+    };
+};
+
 class ExternalChannelCommand: public LineEditSetting, public CISetting {
 public:
     ExternalChannelCommand(const CardInput& parent):
@@ -1285,6 +1296,7 @@
            group->addChild(lnblofhi = new LNBLofHi(*this));
            group->addChild(lnbloflo = new LNBLofLo(*this));
            group->addChild(new FreeToAir(*this));
+           group->addChild(new RadioServices(*this));
         }
 #endif
         addChild(group);
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to