[mythtv] writing dvb channels and transports into DB

Ed Wildgoose lists at wildgooses.com
Tue Nov 30 14:46:17 UTC 2004


Marcus Metzler wrote:

>Hi, 
>I am just trying to add some formats to libdvb for converting
>satellite (or other lists). I already added s/c/tzap and vdr formats
>for reading and writing and want to write (and maybe read) a format
>that can be used for mythtv.
>What would be the best way for that?
>I could try and add mysql reading and writing, but I haven`t done much
>with mysql and I am not sure if that is the best idea. I might screw
>up the entire database. I could write a file with instructions for the
>database which would then be INSERT INTO `channel` and INSERT INTO
>`dvb_transport`. Would that be enough, or do I need more data?
>  
>

Have a peek in some of the code like Mythfilldatabase.  You can ask for 
the pointer to an already opened database and get a handle.  Then you 
can read and write at will.

Better yet I think you will find a wrapper around the channel object 
somewhere in libmythtv (I might be confused about that though...?).  If 
not then we could probably benefit from one, ie an object which lets you 
select a channel, then provides properties to let you edit the details 
of the channel and save them.

However, I wouldn't worry too much about SQL.  It's actually pretty 
straightforward once you have messed up a couple of databases....!  
mysql has a cute feature called "replace into", which is like "insert", 
but doesn't fail if the row already exists, instead it overwrites the 
row.  Quite useful!

You will need to have a quick poke at the archive here to get a better 
idea of schema.  But right now (before the new dvb update) you have 
"channel" which stores the basic channel details, and "dvb_channel" 
which has the dvb extra stuff, and dvb_pids (self explanatory).

I havent looked at the new schema, but generally speaking I would favour 
development pre-fixing table names with the area it's relevant to to 
make the DB as self explantory as possible.  So these new tables should 
have some prefix like DVB_ or ATSC_ or perhaps DTV_ (digital tv)...?

I may be able to help with some questions on this.  The other interested 
folks are fairly easy to spot, although Kenneth has gone a little quiet 
recently but he implemented much of the current status quo (based on 
Ben's initial work)

Good luck

Ed W


More information about the mythtv-dev mailing list