[mythtv] [PATCH] Channel preset hack

Ben Bucksch linux.news at bucksch.org
Thu May 15 21:50:28 EDT 2003


As discussed several times, European users expect to be able to 
configure the number they use for channels (called "preset") and to 
never ever see the frequency / on-the-air-channum apart from the setup. 
Additionally, many European channels are on extended ranges and their 
channums start eith "E" or "SE" (5 of my 6 favourite channels do), 
preventing the ability to enter them with the remote and so leaving no 
way to directly skip to such a channel.

To do this perfectly, a rework of the channel/station handling of MythTV 
is needed. Bjorn Hijmans showed some interest in that, and I am looking 
forward to his possible contributions. For now, I implemented a hack 
that does the trick. It is not meant for checkin to CVS, only for people 
who need it.

I just added another column ("channum_real") to the database which 
stores the real channum used for tuning. The existing "channum" column 
is then free for the user to be (ab)used for presets. This fake channum 
/ preset will then be used to jump to channels, in the UI, in MythWeb 
and internally - everywhere where currently the channum is used. Even 
ChanUp/Down now works as expected for me.

Before you can use it, you have to run the following MySQL commands in 
mysql:
use mythconverg;
ALTER TABLE channel ADD COLUMN channum_real VARCHAR(128) NOT NULL;
UPDATE channel SET channum_real=channum;
You must not run the latter command after you changed the channum/preset 
column, that's why I didn't add it to cvs.sql

There is no UI to set up the presets, you have to manually modify the 
database. You can do that with the program |mysql|, e.g.:
use mythconverg;
UPDATE channel SET channum="1" WHERE callsign="ARD";
or any other MySQL frontend.

I hope this helps a few people.
-------------- next part --------------
Index: libs/libmythtv/channel.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/channel.cpp,v
retrieving revision 1.45
diff -u -r1.45 channel.cpp
--- libs/libmythtv/channel.cpp	14 May 2003 02:43:29 -0000	1.45
+++ libs/libmythtv/channel.cpp	15 May 2003 18:34:12 -0000
@@ -299,7 +299,7 @@
         return false;
 
     pthread_mutex_lock(&db_lock);
-    QString thequery = QString("SELECT finetune "
+    QString thequery = QString("SELECT channum_real,finetune "
                                " FROM channel WHERE channum = \"%1\";")
                                .arg(chan);
 
@@ -313,14 +313,17 @@
     }
     query.next();
 
-    int finetune = query.value(0).toInt();
+    QString channum = query.value(0).toString();
+    int finetune = query.value(1).toInt();
+
+    cout <<"tuning to " << channum << " " << finetune << endl;
 
     pthread_mutex_unlock(&db_lock);
 
     // Tune
     if (externalChanger[currentcapchannel].isEmpty())
     {
-        if (!TuneTo(chan, finetune))
+        if (!TuneTo(channum, finetune))
             return false;
     }
     else if (!ChangeExternalChannel(chan))


More information about the mythtv-dev mailing list