Difference between revisions of "Database editing script"

From MythTV Official Wiki
Jump to: navigation, search
(Template and category)
Line 1: Line 1:
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 a template for changing the default channel numbers in the mythtv database.
 +
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.
 +
 
 +
Specific scripts for UK freeview, freesat and combinations system are available on this page: [[UK_Channel_Assignments]]
 +
 
  
 
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.
 
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.
Line 10: Line 14:
 
Have Fun
 
Have Fun
  
See also [[UK_Channel_Assignments]]
+
 
{{Code box|uk_channel_numbers.sh|
 
 
<pre>
 
<pre>
 
  #!/bin/bash
 
  #!/bin/bash

Revision as of 17:00, 28 November 2010

The script is a template for changing the default channel numbers in the mythtv database. 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.

Specific scripts for UK freeview, freesat and combinations system are available on this page: UK_Channel_Assignments


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


 #!/bin/bash
 
 # 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="bbc1.bbc.co.uk" where callsign="BBC ONE" ;
  update channel set visible=1,channum=2,xmltvid="bbc2.bbc.co.uk" where callsign="BBC TWO" ;
  update channel set visible=1,channum=3,xmltvid="bbcthree.bbc.co.uk" where callsign="BBC THREE" ;
  update channel set visible=1,channum=4,xmltvid="bbcfour.bbc.co.uk" where callsign="BBC FOUR" ;
  update channel set visible=1,channum=5,xmltvid="granada.itv1.itv.co.uk" where callsign="ITV1" ;
  update channel set visible=1,channum=6,xmltvid="itv2.itv.co.uk" where callsign="ITV2" ;
  update channel set visible=1,channum=7,xmltvid="tsod.plus-1.itv2.itv.co.uk" where callsign="ITV2 +1" ;
  update channel set visible=1,channum=8,xmltvid="itv3.itv.co.uk" where callsign="ITV3" ;
  update channel set visible=1,channum=9,xmltvid="itv4.itv.co.uk" where callsign="ITV4" ;
  update channel set visible=1,channum=10,xmltvid="channel4.com" where callsign="Channel 4" ;
  update channel set visible=1,channum=11,xmltvid="tsod.plus-1.channel4.com" where callsign="Channel 4+1" ;
  update channel set visible=1,channum=12,xmltvid="e4.channel4.com" where callsign="E4" ;
  update channel set visible=1,channum=13,xmltvid="tsod.plus-1.e4.channel4.com" where callsign="E4+1" ;
  update channel set visible=1,channum=14,xmltvid="more4.channel4.com" where callsign="More 4" ;
  update channel set visible=1,channum=15,xmltvid="filmfour.channel4.com" where callsign="Film4" ;
  update channel set visible=1,channum=16,xmltvid="channel5.co.uk" where callsign="Five" ;
  update channel set visible=1,channum=17,xmltvid="fiveusa.channel5.co.uk" where callsign="Five USA" ;
  update channel set visible=1,channum=19,xmltvid="fiver.channel5.co.uk" where callsign="FIVER" ;
  update channel set visible=1,channum=20,xmltvid="dave.uktv.co.uk" where callsign="Dave" ;
  update channel set visible=1,channum=21,xmltvid="tsod.plus-1.dave.uktv.co.uk" where callsign="Dave ja vu" ;
  update channel set visible=1,channum=22,xmltvid="1.virginmedia.com" where callsign="Virgin1" ;
  update channel set visible=1,channum=23,xmltvid="tsod.plus-1.freeview.1.virginmedia.com" where callsign="Virgin1+1" ;
  update channel set visible=1,channum=24,xmltvid="sky-three.sky.com" where callsign="SKY THREE" ;
  update channel set visible=1,channum=25,xmltvid="news.bbc.co.uk" where callsign="BBC News" ;
  update channel set visible=1,channum=26,xmltvid="freeview.history.uktv.co.uk" where callsign="UKTV History" ;
  update channel set visible=1,channum=27,xmltvid="freeview.yesterday.uktv.co.uk" where callsign="Yesterday" ;
  update channel set visible=1,channum=100,xmltvid="" where callsign="BBC R5L" ;
 ' | mysql --database=${DBName} --user=${DBUserName} --password=${DBPassword}

}}