[mythtv] [PATCH] (take 2) osd channel browse mode displays junk when no data for channel

Jack Porter jack at porter.net.au
Thu Dec 30 02:18:29 UTC 2004


Sorry, here's the patch again in unified diff format.

Jack Porter wrote:
> Hi,
> 
> When using Browse mode while watching live tv, if you pass a channel for 
> which there is no current program data, junk is displayed instead of the 
> channel name/number.
> 
> This patch makes ProgramInfo::GetProgramAtDateTime() check if 
> ProgramList::FromProgram() returned any results, and if not it looks up 
> just the channel data.
> 
> Cheers
> Jack

-- 
Jack Porter                       Seoul
jack at porter.net.au                South Korea
-------------- next part --------------
Index: mythtv/libs/libmythtv/programinfo.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/programinfo.cpp,v
retrieving revision 1.180
diff -u -r1.180 programinfo.cpp
--- mythtv/libs/libmythtv/programinfo.cpp	26 Dec 2004 02:55:30 -0000	1.180
+++ mythtv/libs/libmythtv/programinfo.cpp	30 Dec 2004 02:16:41 -0000
@@ -503,7 +503,55 @@
     schedList.FromScheduler();
     progList.FromProgram(db, querystr, schedList);
 
-    return progList.take(0);
+    if (!progList.isEmpty())
+    {
+        return progList.take(0);
+    }
+    else
+    {
+        ProgramInfo *p = new ProgramInfo;
+        QString querystr = QString("SELECT chanid, channum, callsign, name, "
+                                   "commfree, outputfilters "
+                                   "FROM channel "
+                                   "WHERE chanid = \"%1\";")
+                                   .arg(channel);
+
+        QSqlQuery query(QString::null, db);
+        query.prepare(querystr);
+
+            if (!query.exec() || !query.isActive())
+        {
+            MythContext::DBError("ProgramInfo::GetProgramAtDateTime", 
+                                 query.executedQuery());
+            return p;
+        }
+
+        if (query.next())
+        {
+            p->chanid = query.value(0).toString();
+            p->startts = dtime;
+            p->endts = dtime;
+            p->recstartts = p->startts;
+            p->recendts = p->endts;
+            p->lastmodified = p->startts;
+            p->title = gContext->GetSetting("UnknownTitle");
+            p->subtitle = "";
+            p->description = "";
+            p->category = "";
+            p->chanstr = query.value(1).toString();
+            p->chansign = QString::fromUtf8(query.value(2).toString());
+            p->channame = QString::fromUtf8(query.value(3).toString());
+            p->repeat = 0;
+            p->chancommfree = query.value(4).toInt();
+            p->chanOutputFilters = query.value(5).toString();
+            p->seriesid = "";
+            p->programid = "";
+            p->year = "";
+            p->stars = 0.f;
+        }
+
+        return p;
+    }
 }
 
 ProgramInfo *ProgramInfo::GetProgramFromRecorded(QSqlDatabase *db,


More information about the mythtv-dev mailing list