[mythtv] [PATCH] Program info on LCD

Tako Schotanus quintesse at palacio-cristal.com
Sat Jun 12 20:36:15 EDT 2004


A couple of days ago I asked if somebody knew if the code behind the
checkbox for channel information was actually inplemented.
As I didn't get a reply I decided to delve into the code to find out and
I noticed that it wasn't so I decided to implement it myself.
So here it is.

For a 2 line display it will show the callsign of the channel you're
watching (LiveTV) or of the channel where the program was originally
recorded on the first line and the title + subtitle on the second. If
your display handles more lines the bottom line will be used to show a
progress bar (doesn't do anything for LiveTV though, wasn't able to
figure that one out).

Unrelated but also included is a 2 character change to increase the
upper limit on the RecordOverTime option from 10 minutes to 30. I have
several channels where 10 minutes is too short and regularly need
something like 15 or even a bit more. Before everybody starts pointing
out the "end late" option for a program: I know it exists, it's just not
what I want, the "end late" option forces MythTV to always use that
extra time while RecordOverTime is only a "suggestion" and that's just
how I like it :-)

Cheers,
  -Tako

PS: The option to show the Volume on the LCD isn't implemented either!
(but who knows, maybe I'll take a look at that as well some day).


-------------- next part --------------
Index: libs/libmyth/lcddevice.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/lcddevice.cpp,v
retrieving revision 1.28
diff -u -2 -r1.28 lcddevice.cpp
--- libs/libmyth/lcddevice.cpp	10 Apr 2004 19:31:56 -0000	1.28
+++ libs/libmyth/lcddevice.cpp	12 Jun 2004 23:28:48 -0000
@@ -370,4 +370,5 @@
     sendToServer("screen_set Channel priority 255");
     sendToServer("widget_add Channel topWidget string");
+    sendToServer("widget_add Channel botWidget string");
     sendToServer("widget_add Channel progressBar hbar");
    
@@ -688,18 +689,21 @@
     if (lcd_showchannel)
       sendToServer("screen_set Channel priority 64");
-    channelTimer->start(500, FALSE);
     aString = channum;
-    aString += ": ";
-    aString += title;
+    theMode = 2;
+    assignScrollingText(aString, "topWidget", 1);
+    aString = title;
     if(subtitle.length() > 0)
     {
-        aString += " (";
+        aString += " - '";
         aString += subtitle;
-        aString += ")";
+        aString += "'";
+    }
+    assignScrollingText(aString, "botWidget", 2);
+    if (lcdHeight > 2)
+    {
+        progress = 0.0;
+        channelTimer->start(500, FALSE);
+        outputChannel();
     }
-    theMode = 2;
-    assignScrollingText(aString);
-    progress = 0.0;
-    outputChannel();
 }
 
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.186
diff -u -2 -r1.186 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	11 Jun 2004 03:16:54 -0000	1.186
+++ libs/libmythtv/tv_play.cpp	12 Jun 2004 23:28:50 -0000
@@ -69,4 +69,5 @@
 
 const int kMuteTimeout = 800;
+const int kLCDTimeout = 1000;
 
 void TV::InitKeys(void)
@@ -232,4 +233,7 @@
     sleepTimer = new QTimer(this);
     connect(sleepTimer, SIGNAL(timeout()), SLOT(SleepEndTimer()));
+
+    lcdTimer = new QTimer(this);
+    connect(lcdTimer, SIGNAL(timeout()), SLOT(UpdateLCD()));
 }
 
@@ -362,4 +366,11 @@
     if (m_db)
         delete m_db;
+
+    gContext->GetLCDDevice()->switchToTime();
+    if (lcdTimer)
+    {
+        lcdTimer->stop();
+        delete lcdTimer;
+    }
 }
 
@@ -496,4 +507,7 @@
     changeState = true;
 
+    gContext->GetLCDDevice()->switchToChannel(rcinfo->chansign, rcinfo->title, rcinfo->subtitle);
+    lcdTimer->start(kLCDTimeout, false);
+
     return 1;
 }
@@ -750,4 +764,7 @@
     changeState = false;
 
+    if (internalState == kState_WatchingLiveTV)
+        UpdateLCD();
+
     if (recorder)
         recorder->FrontendReady();
@@ -2192,5 +2209,8 @@
 
     if (activenvp == nvp)
+    {
         UpdateOSDInput();
+        UpdateLCD();
+    }
 }
 
@@ -2265,4 +2285,5 @@
     {
         UpdateOSD();
+        UpdateLCD();
         AddPreviousChannel();
     }
@@ -2459,4 +2480,5 @@
     {
         UpdateOSD();
+        UpdateLCD();
         AddPreviousChannel();
     }
@@ -2598,4 +2620,31 @@
 }
 
+void TV::UpdateLCD(void)
+{
+    if (internalState == kState_WatchingLiveTV)
+    {
+        QString title, subtitle, callsign, dummy;
+        GetChannelInfo(recorder, title, subtitle, dummy, dummy, dummy, dummy, callsign, dummy, dummy, dummy, dummy, dummy);
+        if ((callsign != lcdCallsign) || (title != lcdTitle) || (subtitle != lcdSubtitle))
+        {
+            gContext->GetLCDDevice()->switchToChannel(callsign, title, subtitle);
+            lcdCallsign = callsign;
+            lcdTitle = title;
+            lcdSubtitle = subtitle;
+        }
+    }
+
+    float progress = 0.0;
+    if (activenvp)
+    {
+        QString dummy;
+        int pos = activenvp->calcSliderPos(dummy);
+        progress = (float)pos / 1000;
+    }
+    gContext->GetLCDDevice()->setChannelProgress(progress);
+
+    lcdTimer->start(kLCDTimeout, true);
+}
+
 void TV::GetNextProgram(RemoteEncoder *enc, int direction,
                         QMap<QString, QString> &infoMap)
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.73
diff -u -2 -r1.73 tv_play.h
--- libs/libmythtv/tv_play.h	5 Jun 2004 01:20:32 -0000	1.73
+++ libs/libmythtv/tv_play.h	12 Jun 2004 23:28:50 -0000
@@ -102,4 +102,5 @@
     void TreeMenuEntered(OSDListTreeType *tree, OSDGenericTree *item);
     void TreeMenuSelected(OSDListTreeType *tree, OSDGenericTree *item);
+    void UpdateLCD(void);
 
   protected:
@@ -320,4 +321,7 @@
 
     char vbimode;
+
+    QTimer *lcdTimer;
+    QString lcdTitle, lcdSubtitle, lcdCallsign;
 };
 
Index: programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.173
diff -u -2 -r1.173 globalsettings.cpp
--- programs/mythfrontend/globalsettings.cpp	11 Jun 2004 03:16:54 -0000	1.173
+++ programs/mythfrontend/globalsettings.cpp	12 Jun 2004 23:28:53 -0000
@@ -567,5 +567,5 @@
 public:
     RecordOverTime():
-        SpinBoxSetting(0, 600, 60, true),
+        SpinBoxSetting(0, 1800, 60, true),
         BackendSetting("RecordOverTime") {
         setLabel(QObject::tr("Time to record past end of show (in seconds)"));



More information about the mythtv-dev mailing list