[mythtv] [PATCH] GetNextProgram for a channel without programme info

David Matthews dm at prolingua.co.uk
Fri Oct 29 13:50:05 UTC 2004


I have a number of radio channels in my setup for which there is no 
programme information available.  When I changed to the channel the 
on-screen display showed the correct information but if I used the 
channel browser the programme length was a large negative number and 
the channel callsign was missing.  It turned out that 
TVRec::GetNextProgram wasn't handling the case of failing to get 
programme information from the database in the same way as 
GetChannelInfo.  This patch fixes GetNextProgram so that it works in 
the same way.

This is the first time I've submitted a patch so let me know if using a 
different format or procedure would make things easier in the future.
David.

-------------- next part --------------
--- libs/libmythtv/tv_rec.cpp   22 Oct 2004 09:45:24 -0000      1.165
+++ libs/libmythtv/tv_rec.cpp   29 Oct 2004 12:01:16 -0000
@@ -2057,16 +2057,26 @@
     }
     else
     {
-        QDateTime curtime = QDateTime::currentDateTime();
-        starttime = curtime.toString("yyyyMMddhhmm") + "00";
+        // Couldn't get programme info.  Get the channel info and clear everything else.
+        starttime = "";
+        endtime = "";
+        title = "";
+        subtitle = "";
+        desc = "";
+        category = "";
+        seriesid = "";
+        programid = "";

-        querystr = QString("SELECT channum FROM channel WHERE chanid = %1;")
+        querystr = QString("SELECT channum, callsign, icon, chanid FROM channel WHERE chanid = %1;")
                            .arg(chanid);
         sqlquery = db_conn->exec(querystr);

-        if ((sqlquery.isActive()) && (sqlquery.numRowsAffected() > 0))
-            if (sqlquery.next())
-                channelname = sqlquery.value(0).toString();
+        if ((sqlquery.isActive()) && (sqlquery.numRowsAffected() > 0) && sqlquery.next()) {
+            channelname = sqlquery.value(0).toString();
+            callsign = sqlquery.value(1).toString();
+            iconpath = sqlquery.value(2).toString();
+            chanid = sqlquery.value(3).toString();
+        }
     }

     pthread_mutex_unlock(&db_lock);


More information about the mythtv-dev mailing list