<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span><br></span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> tortise <tortise@paradise.net.nz><br> <b><span style="font-weight: bold;">To:</span></b> stephen@jsw.gen.nz; MythTV in NZ <mythtvnz@lists.linuxnut.co.nz> <br> <b><span style="font-weight: bold;">Sent:</span></b> Sunday, 17 June 2012 10:13 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [mythtvnz] Wellington Channel Retuning 19 June 2012<br> </font> </div> <br>On
 16/06/2012 10:07 p.m., Stephen Worthington wrote:<br>> On Sat, 16 Jun 2012 19:07:28 +1200, you wrote:<br>><br>>> On Sat, Jun 16, 2012 at 6:47 PM, tortise<<a ymailto="mailto:tortise@paradise.net.nz" href="mailto:tortise@paradise.net.nz">tortise@paradise.net.nz</a>>  wrote:<br>>>> Wellington users may not be aware of<br>>>> <a href="http://www.rsm.govt.nz/cms/policy-and-planning/projects/digital-terrestrial-television-frequency-restacking/timing-and-channel-information" target="_blank">http://www.rsm.govt.nz/cms/policy-and-planning/projects/digital-terrestrial-television-frequency-restacking/timing-and-channel-information</a><br>>>><br>>>> For kaukau<br>>>><br>>>> 50>  32<br>>>> 48>  32<br>>><br>>> no 48 goes to 34 I think.<br>>><br>>>> 59>  36<br>>>><br>>><br>>> Yes I see we are next! (after you I
 mean).<br>>><br>>> Are you suggesting just changing the freqid? I am not sure that will<br>>> work if the serviceids change too.<br>>><br>>>> I suppose it can also be done through SQL, but for the time it would take to<br>>>> do I am presuming one can do this thru<br>>>><br>>>> /mythweb/settings/tv/channels<br>>>><br>>>> sql seems more risky and would take longer.<br>>>><br>>><br>>> No it would be three lines, if simply changing the freqid works (see above)<br>><br>> The Kaukau changes are identical to what the Wharite changes in May<br>> were, so here is the script I used then:<br>><br>> #!/bin/bash<br>> # Update the channel frequencies for FreeviewHD from Kaukau for the<br>> # 19-Jun-2012 changes.<br>> source /etc/mythtv/mysql.txt<br>> mysql -u $DBUserName -p$DBPassword -h $DBHostName $DBName<<  EOF<br>> drop
 function if exists calcfreq;<br>> delimiter $$<br>> create function calcfreq(freqid int) returns int<br>> begin<br>>      return (506000000+(8000000*(freqid - 25)));<br>> end$$<br>> delimiter ;<br>><br>> set @freqid1 =    50;<br>> set @newfreqid1 = 32;<br>> set @freqid2 =    48;<br>> set @newfreqid2 = 34;<br>> set @freqid3 =    59;<br>> set @newfreqid3 = 36;<br>><br>> update channel set freqid = @newfreqid1 where freqid = @freqid1;<br>> update channel set freqid = @newfreqid2 where freqid = @freqid2;<br>> update channel set freqid = @newfreqid3 where freqid = @freqid3;<br>> update dtv_multiplex set frequency = calcfreq(@newfreqid1) where<br>> frequency = calcfreq(@freqid1);<br>> update dtv_multiplex set frequency = calcfreq(@newfreqid2) where<br>> frequency = calcfreq(@freqid2);<br>> update dtv_multiplex set frequency = calcfreq(@newfreqid3)
 where<br>> frequency = calcfreq(@freqid3);<br>><br>> drop function calcfreq;<br>> EOF<br>><br>> exit 0<br>><br>><br>> This will change the "freqid" values, and the "frequency" values.  I<br>> think the "frequency" value in the dtv_multiplex table is all that<br>> matters, but if the "freqid" values are also there in the channel<br>> table it would be best to have them matching.  The tuning code for<br>> DVB-T looks up the mplexid in the channel table, and uses that to<br>> index the dtv_multiplex table for the tuning data.  It uses the<br>> "frequency" value from dtv_multiplex to tune to the multiplex, then<br>> uses the "serviceid" from the channel table to select the channel on<br>> that multiplex.  The "freqid" value in the channel table is used to<br>> tune analogue channels, but as far as I can tell it is ignored when<br>> tuning digital channels.<br>><br>> If you
 are using one of the other Wellington transmitters affected by<br>> this change (Haywards, Fitzherbert or Baxter's Knob) and want to use<br>> this script, you will need to fill in the correct values from the URL<br>> above in the script's "set" statement pairs.<br>><br>> All that is changing are the frequencies the multiplexes are broadcast<br>> on - there are no changes to other things like "serviceid" values.<br><br>Thanks Stephen, that's really cool and I am sure will be used by more <br>than me!<br><br>I note the dev's were talking about removing mysql.txt, I think in favor <br>of xml. I suppose mysql.xml could be used instead but I couldn't code <br>using that in any great hurry. Perhaps its still easy to use?<br><br>_______________________________________________<br>mythtvnz mailing list<br><a ymailto="mailto:mythtvnz@lists.linuxnut.co.nz" href="mailto:mythtvnz@lists.linuxnut.co.nz">mythtvnz@lists.linuxnut.co.nz</a><br><a
 href="http://lists.ourshack.com/mailman/listinfo/mythtvnz" target="_blank">http://lists.ourshack.com/mailman/listinfo/mythtvnz</a><br>Archives <a href="http://www.gossamer-threads.com/lists/mythtv/mythtvnz/" target="_blank">http://www.gossamer-threads.com/lists/mythtv/mythtvnz/</a><br><br>>> Thanks from me too. I was wondering how I was going to make the channel change.<br><br> </div> </div> </blockquote></div>   </div></body></html>