[mythtv] [PATCH] Some small changes to the EPG (resend!)

Tako Schotanus quintesse at palacio-cristal.com
Thu Jul 31 11:04:48 EDT 2003


Hmmm, I've gotten zero response to this, did any of the Mythological
gods read/consider it or am I just being impatient? :-)

-Tako

----------------------------------------------------

This patch changes the following behaviour in the EPG:

-1- the fact that only favorite channels are shown is now remembered in 
the database as a setting
-2- channels with null or empty channel numbers will now be completely 
ignored

The epg.patch file just contains the plain changes as per "diff -bu2" 
which the epg_ws.patch also includes the whitespace diffs because I had 
to indent/undent some bocks of code. Isaac can decide to use whatever he

thinks is best.

Cheers,
 -Tako

ad 1) reasoning behind this feature is that I _really_ don't like seeing

the channels I never watch in the list, but I don't want to remove them 
either "just in case" (maybe I'll decide to learn Chinese some day, who 
knows), this way if you turn on "show favorites only" (press '4' in EPG)

it will stay that way.

ad 2) I explained the necessity for this in a mail some days ago, but 
I'll repeat it here just to be sure: not all tv_grab scripts allow you 
to select which channels you want, the tv_grab_nl_wolf for example is a 
_lot_ faster than the tv_grab_nl script but it just gives you all 
possible channels, regardless of the fact if you even get all of those 
channels. So I have a list of channels which appear in the database but 
which don't have channel numbers because I can't receive them. But with 
the current version I would get a lot of empty lines between the proper 
channels (incidently messing up the rendering of the EPG completely).

PS: Isaac, I wanted to change the favorite indication from * <channel> *

to something that uses a color but it seemed a lot more difficult than I

expected. Any hints you could give me? (Why colors? Well, some channel 
callsigns are a bit long, "Discovery" for example, and they don't fit in

the box reserved for them. That's okay because I understand them anyway,

but the two asterisks disappear completely. That's why I thought of the 
color).

PS2: Chris, I've not yet changed mythweb2 to filter out the channels 
without channel numbers. It's 3:15 am now so I think I'll call it a day,

but maybe you can still find time to do it....? :-))))

-------------- next part --------------
Index: libs/libmythtv/guidegrid.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/guidegrid.cpp,v
retrieving revision 1.123
diff -b -u -2 -r1.123 guidegrid.cpp
--- libs/libmythtv/guidegrid.cpp	21 Jul 2003 15:46:50 -0000	1.123
+++ libs/libmythtv/guidegrid.cpp	30 Jul 2003 00:58:17 -0000
@@ -78,5 +78,4 @@
     int maxchannel = 0;
     m_currentStartChannel = 0;
-    showFavorites = false;
 
     m_player = player;
@@ -109,4 +108,5 @@
     LoadWindow(xmldata);
 
+    showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);
     gridfilltype = gContext->GetNumSetting("EPGFillType", 6);
     scrolltype = gContext->GetNumSetting("EPGScrollType", 1);
@@ -433,4 +433,6 @@
         {
             ChannelInfo val;
+            val.chanstr = query.value(0).toString();
+            if ((val.chanstr != QString::null) && (val.chanstr != "")) {
             val.callsign = query.value(1).toString();
             if (val.callsign == QString::null)
@@ -441,7 +443,4 @@
             if (val.iconpath.stripWhiteSpace().length() == 0)
                 val.iconpath = "(null)";
-            val.chanstr = query.value(0).toString();
-            if (val.chanstr == QString::null)
-                val.chanstr = "";
             val.chanid = query.value(3).toInt();
             val.favid = query.value(4).toInt();
@@ -458,4 +457,5 @@
         }
     }
+    }
     else
     {
@@ -559,6 +559,4 @@
         chanNum = 0;
 
-    if (m_channelInfos[chanNum].chanstr != "")
-    {
         m_programs[row] = proglist = new QPtrList<ProgramInfo>;
         m_programs[row]->setAutoDelete(true);
@@ -641,5 +639,4 @@
             proglist->append(proginfo);
         }
-    }
 
     int ydifference = programRect.height() / DISPLAY_CHANS;
@@ -851,7 +848,4 @@
             chanNumber -= m_channelInfos.size();
   
-        if (m_channelInfos[chanNumber].chanstr == "")
-            break;
-
         chinfo = &(m_channelInfos[chanNumber]);
         if ((y == (unsigned int)2 && scrolltype != 1) || 
@@ -1066,4 +1060,5 @@
 {
     showFavorites = (!showFavorites);
+    gContext->SaveSetting("EPGShowFavorites", showFavorites);
     generateListings();
 }
-------------- next part --------------
Index: libs/libmythtv/guidegrid.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/guidegrid.cpp,v
retrieving revision 1.123
diff -u -2 -r1.123 guidegrid.cpp
--- libs/libmythtv/guidegrid.cpp	21 Jul 2003 15:46:50 -0000	1.123
+++ libs/libmythtv/guidegrid.cpp	30 Jul 2003 00:56:02 -0000
@@ -78,5 +78,4 @@
     int maxchannel = 0;
     m_currentStartChannel = 0;
-    showFavorites = false;
 
     m_player = player;
@@ -109,4 +108,5 @@
     LoadWindow(xmldata);
 
+    showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);
     gridfilltype = gContext->GetNumSetting("EPGFillType", 6);
     scrolltype = gContext->GetNumSetting("EPGScrollType", 1);
@@ -433,27 +433,27 @@
         {
             ChannelInfo val;
-            val.callsign = query.value(1).toString();
-            if (val.callsign == QString::null)
-                val.callsign = "";
-            val.iconpath = query.value(2).toString();
-            if (val.iconpath == QString::null)
-                val.iconpath = "(null)";
-            if (val.iconpath.stripWhiteSpace().length() == 0)
-                val.iconpath = "(null)";
             val.chanstr = query.value(0).toString();
-            if (val.chanstr == QString::null)
-                val.chanstr = "";
-            val.chanid = query.value(3).toInt();
-            val.favid = query.value(4).toInt();
-            val.icon = NULL;
+            if ((val.chanstr != QString::null) && (val.chanstr != "")) {
+	        val.callsign = query.value(1).toString();
+                if (val.callsign == QString::null)
+                    val.callsign = "";
+                val.iconpath = query.value(2).toString();
+                if (val.iconpath == QString::null)
+                    val.iconpath = "(null)";
+                if (val.iconpath.stripWhiteSpace().length() == 0)
+                    val.iconpath = "(null)";
+                val.chanid = query.value(3).toInt();
+                val.favid = query.value(4).toInt();
+                val.icon = NULL;
         
-            if (gotostartchannel && val.chanstr == m_startChanStr && !set)
-            {
-                m_currentStartChannel = m_channelInfos.size();
-                set = true;
+                if (gotostartchannel && val.chanstr == m_startChanStr && !set)
+                {
+                    m_currentStartChannel = m_channelInfos.size();
+                    set = true;
+                }
+                    
+                m_channelInfos.push_back(val);
+                maxchannel++;
             }
-                
-            m_channelInfos.push_back(val);
-            maxchannel++;
         }
     }
@@ -559,87 +559,84 @@
         chanNum = 0;
 
-    if (m_channelInfos[chanNum].chanstr != "")
-    {
-        m_programs[row] = proglist = new QPtrList<ProgramInfo>;
-        m_programs[row]->setAutoDelete(true);
-
-        QString chanid = QString("%1").arg(m_channelInfos[chanNum].chanid);
+     m_programs[row] = proglist = new QPtrList<ProgramInfo>;
+     m_programs[row]->setAutoDelete(true);
 
-        char temp[16];
-        sprintf(temp, "%4d%02d%02d%02d%02d00",
-                m_currentStartTime.date().year(),
-                m_currentStartTime.date().month(),
-                m_currentStartTime.date().day(),
-                m_currentStartTime.time().hour(),
-                m_currentStartTime.time().minute());
-        QString starttime = temp;
-        sprintf(temp, "%4d%02d%02d%02d%02d00",
-                m_currentEndTime.date().year(),
-                m_currentEndTime.date().month(),
-                m_currentEndTime.date().day(),
-                m_currentEndTime.time().hour(),
-                m_currentEndTime.time().minute());
-        QString endtime = temp;
-
-        ProgramInfo::GetProgramRangeDateTime(m_db, proglist, chanid, starttime, 
-                                             endtime);
-
-        QDateTime ts = m_currentStartTime;
-
-        program = proglist->first();
-        QPtrList<ProgramInfo> unknownlist;
-        bool unknown = false;
+     QString chanid = QString("%1").arg(m_channelInfos[chanNum].chanid);
 
-        for (int x = 0; x < DISPLAY_TIMES; x++)
-        {
-            if (program && (ts >= (*program).endts))
-            {
-                program = proglist->next();
-            }
-
-            if ((!program) || (ts < (*program).startts))
-            {
-                if (unknown)
-                {
-                    proginfo->spread++;
-                    proginfo->endts = proginfo->endts.addSecs(5 * 60);
-                }
-                else
-                {
-                    proginfo = new ProgramInfo;
-                    unknownlist.append(proginfo);
-                    proginfo->title = unknownTitle;
-                    proginfo->category = unknownCategory;
-                    proginfo->startCol = x;
-                    proginfo->spread = 1;
-                    proginfo->startts = ts;
-                    proginfo->endts = proginfo->startts.addSecs(5 * 60);
-                    unknown = true;
-                }
-            }
-            else
-            {
-                if (proginfo == &*program)
-                {
-                    proginfo->spread++;
-                }
-                else
-                {
-                    proginfo = &*program;
-                    proginfo->startCol = x;
-                    proginfo->spread = 1;
-                    unknown = false;
-                }
-            }
-            m_programInfos[row][x] = proginfo;
-            ts = ts.addSecs(5 * 60);
-        }
-
-        for (proginfo = unknownlist.first(); proginfo; 
-             proginfo = unknownlist.next())
-        {
-            proglist->append(proginfo);
-        }
-    }
+     char temp[16];
+     sprintf(temp, "%4d%02d%02d%02d%02d00",
+             m_currentStartTime.date().year(),
+             m_currentStartTime.date().month(),
+             m_currentStartTime.date().day(),
+             m_currentStartTime.time().hour(),
+             m_currentStartTime.time().minute());
+     QString starttime = temp;
+     sprintf(temp, "%4d%02d%02d%02d%02d00",
+             m_currentEndTime.date().year(),
+             m_currentEndTime.date().month(),
+             m_currentEndTime.date().day(),
+             m_currentEndTime.time().hour(),
+             m_currentEndTime.time().minute());
+     QString endtime = temp;
+
+     ProgramInfo::GetProgramRangeDateTime(m_db, proglist, chanid, starttime, 
+                                          endtime);
+
+     QDateTime ts = m_currentStartTime;
+
+     program = proglist->first();
+     QPtrList<ProgramInfo> unknownlist;
+     bool unknown = false;
+
+     for (int x = 0; x < DISPLAY_TIMES; x++)
+     {
+         if (program && (ts >= (*program).endts))
+         {
+             program = proglist->next();
+         }
+
+         if ((!program) || (ts < (*program).startts))
+         {
+             if (unknown)
+             {
+                 proginfo->spread++;
+                 proginfo->endts = proginfo->endts.addSecs(5 * 60);
+             }
+             else
+             {
+                 proginfo = new ProgramInfo;
+                 unknownlist.append(proginfo);
+                 proginfo->title = unknownTitle;
+                 proginfo->category = unknownCategory;
+                 proginfo->startCol = x;
+                 proginfo->spread = 1;
+                 proginfo->startts = ts;
+                 proginfo->endts = proginfo->startts.addSecs(5 * 60);
+                 unknown = true;
+             }
+         }
+         else
+         {
+             if (proginfo == &*program)
+             {
+                 proginfo->spread++;
+             }
+             else
+             {
+                 proginfo = &*program;
+                 proginfo->startCol = x;
+                 proginfo->spread = 1;
+                 unknown = false;
+             }
+         }
+         m_programInfos[row][x] = proginfo;
+         ts = ts.addSecs(5 * 60);
+     }
+
+     for (proginfo = unknownlist.first(); proginfo; 
+          proginfo = unknownlist.next())
+     {
+         proglist->append(proginfo);
+     }
 
     int ydifference = programRect.height() / DISPLAY_CHANS;
@@ -851,7 +848,4 @@
             chanNumber -= m_channelInfos.size();
   
-        if (m_channelInfos[chanNumber].chanstr == "")
-            break;
-
         chinfo = &(m_channelInfos[chanNumber]);
         if ((y == (unsigned int)2 && scrolltype != 1) || 
@@ -1066,4 +1060,5 @@
 {
     showFavorites = (!showFavorites);
+    gContext->SaveSetting("EPGShowFavorites", showFavorites);
     generateListings();
 }
-------------- next part --------------
_______________________________________________
mythtv-dev mailing list
mythtv-dev at snowman.net
http://lists.snowman.net/cgi-bin/mailman/listinfo/mythtv-dev


More information about the mythtv-dev mailing list