Database editing script

From MythTV Official Wiki
Revision as of 12:09, 12 May 2010 by GBee (talk | contribs) (Template and category)

Jump to: navigation, search

The script is designed to change the default channel numbers for UK DVB-T (Freeview) to a more sensible range of numbers, it's pretty self explanatory and can be used as a template by users in other countries wishing to do the same thing.

The script is ideal for resetting your channels immediately after a rescan and saves time messing around doing it manually or via mythweb (my previous preferred route). Change the value in channum below to your preferred Channel Number for the channel defined by callsign. This script references the MythTV config file to get database login details, so you don't have to type them in or include them in the script, edit the path (~/.mythtv/mysql.txt) if required to suit your setup.

To find out what channels you should have, and their xmltv ids, see Uk_xmltv#How_to_find_out_which_channels_are_available_and_what_their_xmltv_IDs_are:. This script doesn't configure your xmltv grabber (you have to do that yourself,Uk_xmltv), it just sets the required id in the channel table.

Please use common sense and back up your database BEFORE running this script, if it eats your database it's not our fault!!

Have Fun

See also UK_Channel_Assignments


 # Set MythTV channel numbers
 . ~/.mythtv/mysql.txt
 echo '
  update channel set channum=channum+10000 where channum < 1000 and not channum between 700 and 799 ;;
  update channel set visible=0 where not channum between 700 and 799 ;
  update channel set visible=1,channum=1,xmltvid="" where callsign="BBC ONE" ;
  update channel set visible=1,channum=2,xmltvid="" where callsign="BBC TWO" ;
  update channel set visible=1,channum=3,xmltvid="" where callsign="BBC THREE" ;
  update channel set visible=1,channum=4,xmltvid="" where callsign="BBC FOUR" ;
  update channel set visible=1,channum=5,xmltvid="" where callsign="ITV1" ;
  update channel set visible=1,channum=6,xmltvid="" where callsign="ITV2" ;
  update channel set visible=1,channum=7,xmltvid="" where callsign="ITV2 +1" ;
  update channel set visible=1,channum=8,xmltvid="" where callsign="ITV3" ;
  update channel set visible=1,channum=9,xmltvid="" where callsign="ITV4" ;
  update channel set visible=1,channum=10,xmltvid="" where callsign="Channel 4" ;
  update channel set visible=1,channum=11,xmltvid="" where callsign="Channel 4+1" ;
  update channel set visible=1,channum=12,xmltvid="" where callsign="E4" ;
  update channel set visible=1,channum=13,xmltvid="" where callsign="E4+1" ;
  update channel set visible=1,channum=14,xmltvid="" where callsign="More 4" ;
  update channel set visible=1,channum=15,xmltvid="" where callsign="Film4" ;
  update channel set visible=1,channum=16,xmltvid="" where callsign="Five" ;
  update channel set visible=1,channum=17,xmltvid="" where callsign="Five USA" ;
  update channel set visible=1,channum=19,xmltvid="" where callsign="FIVER" ;
  update channel set visible=1,channum=20,xmltvid="" where callsign="Dave" ;
  update channel set visible=1,channum=21,xmltvid="" where callsign="Dave ja vu" ;
  update channel set visible=1,channum=22,xmltvid="" where callsign="Virgin1" ;
  update channel set visible=1,channum=23,xmltvid="" where callsign="Virgin1+1" ;
  update channel set visible=1,channum=24,xmltvid="" where callsign="SKY THREE" ;
  update channel set visible=1,channum=25,xmltvid="" where callsign="BBC News" ;
  update channel set visible=1,channum=26,xmltvid="" where callsign="UKTV History" ;
  update channel set visible=1,channum=27,xmltvid="" where callsign="Yesterday" ;
  update channel set visible=1,channum=100,xmltvid="" where callsign="BBC R5L" ;
 ' | mysql --database=${DBName} --user=${DBUserName} --password=${DBPassword}