> Everyone's situation is different so it's probably hard to 
> make something that will work for everyone but if you figure 
> out a way to do it please share it with the list. And don't 
> forget to backup your db before messing with this... :)
> 
> 

I have had some success with migrating old DVB channel setup to new table 
structures. These were the steps i used - maybe it helps
some too. 
It is paint to do it, but it can be done. I dont know if this has some bad 
effects on system (Jesper?)

- this is done mostly in mysql, i have used Toad for MySQL from www.quest.com 
from windows machine to make things easier for me.


0. In contract to other reports my install of 0.17 with atrpms packages did not 
brop old dvb_* tables - but is is good to have their
backup:
        create table dvb_channel_bck as select * from dvb_channel;
        create table dvb_pids_bck as select * from dvb_pids;

1. look at table videosource to see what id have a video source that is 
connected to DVB device. DVB channel scanner will create
chanid-s with this SOURCEID*1000. 

2. Check that you existing  CHANNEL table does not have chanid in this 
SOURCEID*1000 span:
        select * from channel where chanid between SOURCEID*1000 and 
(SOURCEID+1)*1000;
-- replace SOURCEID with mumber from your setup.
There shouldn't be any records. If there are - which is bad, you could try to 
define new videosource (mythtvsetup will give it first
next ID)

3. Next you must populate dvt_multiplex table. I have done it with channel 
scan, but i belive it could be also done by selecting
distinct frequencies from dvb_channel - the only information missing in 
old-style tables is SERVICEVERSION - and i dnot know what is
this and if this could be left null or 0.
After you have run scan, new channels will be create too - you can leave them 
as they are, or delete them later on.

4. Now the "clever" part, run following query:

select concat("update channel set sourceid=", dtv_multiplex.sourceid, 
",mplexid=", dtv_multiplex.mplexid,
",serviceid=",dvb_channel.serviceid," where chanid=",channel.chanid)
from channel, dvb_channel, dtv_multiplex 
where channel.chanid = dvb_channel.chanid 
        and channel.serviceid is null 
        and dtv_multiplex.sourceid=SOURCEID and dvb_channel.satid=SATID
        and (dtv_multiplex.transportid=dvb_channel.transportid OR 
                ( dtv_multiplex.frequency=dvb_channel.frequency
                        AND dtv_multiplex.polarity=dvb_channel.polarity  
                )
              ) 
order by channel.channum;

-- replace SOURCEID with SOURCEID of DVB input connection, and SATID with id 
from satelite if you receive more that one satelite
position. 
-If you receive more than one sat (diseq switch), i think you need to create 
separate videosource and input connection for each
diseq port.
-it will give you a bunch update sql statements which update apropriate fields 
(most important SERVICEID) in CHANNEL table.
-if it return less then number of channels you want to migrate, you could try 
changing
"dtv_multiplex.frequency=dvb_channel.frequency" to 
"(SUBSTRING(dtv_multiplex.frequency,1,5)=substring(dvb_channel.frequency,1,5)" 
or
even 
"(SUBSTRING(dtv_multiplex.frequency,1,4)=substring(dvb_channel.frequency,1,4)" 
- this reduces precision of matching frequencies
from old tables to new table to 5 and 4 first digits.

5. You can now delete newly created channels:
        delete from channel where chanid between SOURCEID*1000 and 
(SOURCEID+1)*1000;
, or keep than on some high channum:
        update channel set channum=chanid+20000 where chanid between 
SOURCEID*1000 and (SOURCEID+1)*1000;


and yes - as Jasper said: DON'T FORGET TO BACKUP YOUR DB BEFORE MESSING WITH 
THIS.


br,

k.

_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to