[mythtv-users] Numbering script

Josu Lazkano josu.lazkano at gmail.com
Mon Feb 7 20:57:12 UTC 2011


Hello everybody, I am using Simon's script to number the channels:
http://www.mythtv.org/wiki/Database_editing_script

It works well for a single videosource, but I have two videosource
with same channels, I want to get different number for the differnt
videosources. I change the script this way:

#!/bin/bash

. ~/.mythtv/mysql.txt

echo '
 charset utf8 ;
 update channel set channum=channum+205 where channum < 205 ;
 update channel set visible=1,channum=1 where (callsign="CANAL+" and
sourceid=6) ;
 update channel set visible=1,channum=2 where (callsign="CUATRO" and
sourceid=6) ;
 update channel set visible=1,channum=3 where (callsign="CUATRO" and
sourceid=5) ;
 ...
' | mysql --database=${DBName} --user=${DBUserName} --password=${DBPassword}

If I did not select the sourceid, two channels will set on the same number.

Not always the sourceids are the same (5 and 6), so I need your help
to change the script. This is the videosource export:

INSERT INTO `videosource` (`sourceid`, `name`, `xmltvgrabber`,
`userid`, `freqtable`, `lineupid`, `password`, `useeit`, `configpath`,
`dvb_nit_id`) VALUES
(6, 'DVB-S EIT', 'eitonly', '', 'default', NULL, NULL, 0, NULL, -1),
(5, 'DVB-T EIT', 'eitonly', '', 'default', NULL, NULL, 1, NULL, -1);

Can some mysql expert help with the script? I always use the same
videosource names, so the idea is to make a script to convert the
videosource name to number.

Thanks for all your help and best regards.

-- 
Josu Lazkano


More information about the mythtv-users mailing list