[mythtv] Small patch for mythtv? (European (?) channel names)

Jens Lohmann-Hansen mythtv-dev@snowman.net
Sun, 15 Sep 2002 21:35:00 +0200


Hello again.

Well, I basically gave up on qmake and freetype1/2. I figure the best thing
to do is to port mythtv to freetype2 at some point (and get anti-aliased
fonts etc..).

... So I read a few more posts and noticed that the database structure
apparently isn't well suited for european channel names like "S9" and "E38",
since channum is an int and not a String.

So I began hacking it up, and created a small script to modify the database
table "channel" - adding a column "channel" (should work even with data in
the table):

USE mythconverg;
ALTER TABLE channel ADD channel VARCHAR(5);
UPDATE channel SET channel = channum;
ALTER TABLE channel MODIFY channel VARCHAR(5) NOT NULL UNIQUE KEY;

... And a very small patch to look up the information (but not using it)
(while making the routine use a join and not a C++ inner loop lookup):

1377a1378
>
1401,1405c1402,1412
<     QString thequery = QString("SELECT channum,starttime,endtime,title,"
<                                "subtitle,description,category FROM program
"
<                                "WHERE channum = %1 AND starttime < %2 AND
"
<                                "endtime >
%3;").arg(lchannel).arg(curtimestr)
<                                .arg(curtimestr);
---
>     QString thequery = QString("SELECT prg.channum,"
>                                       "prg.starttime,prg.endtime,"
>                                       "prg.title,prg.subtitle,"
>                                       "prg.description,prg.category,"
>                                       "chn.callsign,chn.icon,chn.channel "
>                                  "FROM channel chn,program prg "
>                                 "WHERE chn.channum = prg.channum "
>                                   "AND prg.channum = %1 "
>                                   "AND prg.starttime < %2 "
>                                   "AND prg.endtime > %3;")
>                            .arg(lchannel).arg(curtimestr).arg(curtimestr);
1428,1438c1435
<     }
<
<     thequery = QString("SELECT callsign,icon FROM channel WHERE channum "
<                        "= %1;").arg(lchannel);
<
<     query = db_conn->exec(thequery);
<     if (query.isActive() && query.numRowsAffected() > 0)
<     {
<         query.next();
<
<         test = query.value(0).toString();
---
>         test = query.value(7).toString();
1441c1438
<         test = query.value(1).toString();
---
>         test = query.value(8).toString();
1445a1443
>

The above is untested - it compiles, however.

So is this the way to go, or are you/we going for the approach posted last
month about multiple broadcasters, capturecards and cardinputs?

One last thing: Am I babbling too much? Are you interested in my
suggestions?

/Jens