<div class="gmail_quote">On Mon, Aug 16, 2010 at 10:36 PM, Daniel Kristjansson <span dir="ltr">&lt;<a href="mailto:danielk@cuymedia.net">danielk@cuymedia.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Mon, 2010-08-16 at 20:28 -0400, Larry K wrote:<br>
&gt; Comcast is changing my QAM channel layout every other day it seems, so<br>
&gt; I&#39;m getting tired of rescanning channels in mythtv-setup.  it&#39;s soooo<br>
&gt; tedious to fix all the channel numbers and xmltvids post-scan.  So, I<br>
&gt; borrowed a script from the HDHR forum to insert the correct channels.<br>
&gt;  I have it almost ready to go, except that the script is borking the<br>
&gt; chanid by supplying an alphanumeric value.  It needs to be numeric.<br>
&gt;  Does anyone know how mythtv calculates the chanid value when<br>
&gt; inserting a new channel?  Most of the time, it looks like some funky<br>
&gt; combination of (sourceid*1000) + serviceid, but not always.<br>
<br>
</div></div>The chanid is arbitrary. There is a sourceid*1000 + int(channum)<br>
type thing that tries to pick chanid&#39;s that humans debugging the<br>
program will find appealing.. but it doesn&#39;t try very hard to do<br>
so and will pick non-conflicted chanid&#39;s pretty arbitrarily if<br>
there is any kind of collision. What is important is that the same<br>
chanid is used in other tables referring to that channel.<br>
<br>
--Daniel<br>
<br><br></blockquote><div><br></div><div>Every time you rescan the channels in mythtv-setup, the chanids are subject to change, right?  The rows in the channel table get deleted and re-added AFAIK.  So, how do these ever-changing chanids get reconciled against all the other tables that make reference to chanid?  Like, channelgroup?  I see nothing like a cascading delete FK relationship that could be cleaning the other tables when the channel table gets purged.  This makes me wonder if it is even possible to script the loading of new channels outside the mythtv scan process.</div>
<div><br></div><div> </div></div><br>