<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 9, 2022 at 11:16 AM Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, 9 Oct 2022 09:33:50 -0400, you wrote:<br>
<br>
>I used to think that I could get the channel ID by using '1' + major<br>
>number + '0' + minor number.<br>
>i.e. for channel 50_1 the channel ID is '15001'<br>
><br>
>But I find that 22_2 has a channel ID of 16223?<br>
><br>
>So I need a list of these. How do I run an SQL command to produce a<br>
>complete list of chanid against more useful data?<br>
<br>
When scanning, the chanid is set to something meaningful if possible.<br>
But if the meaningful value is already taken, it will get something<br>
else. Originally, chanid values were supposed to be only used<br>
internally in the database and not by the users, but since they show<br>
up in all sorts of useful places (such as recording file names), the<br>
users do actually use them, and later versions of the scanning code<br>
were altered to deliberately create somewhat sensible values. Channels<br>
created before the meaningful values era often got totally meaningless<br>
values when they were added to an existing set of prior channels, as<br>
they got a number larger than the largest existing chanid.<br>
<br>
To get chanid values matched to other useful data, I start with a<br>
query like this:<br>
<br>
select chanid,channum,sourceid,callsign,name,xmltvid,mplexid,serviceid<br>
from channel order by sourceid,channum+0;<br>
<br>
which gives output like this:<br>
<br>
+--------+---------+----------+-------------------+------------------------------+---------------------------------+---------+-----------+<br>
| chanid | channum | sourceid | callsign | name | xmltvid | mplexid | serviceid |<br>
+--------+---------+----------+-------------------+------------------------------+---------------------------------+---------+-----------+<br>
| 1001 | 1 | 1 | TVNZ 1 | TVNZ 1 | <a href="http://tvnz1.freeviewnz.tv" rel="noreferrer" target="_blank">tvnz1.freeviewnz.tv</a> | 2 | 1200 |<br>
| 1002 | 2 | 1 | TVNZ 2 | TVNZ 2 | <a href="http://tvnz2.freeviewnz.tv" rel="noreferrer" target="_blank">tvnz2.freeviewnz.tv</a> | 2 | 1201 |<br>
| 1003 | 3 | 1 | Three | Three | <a href="http://three.freeviewnz.tv" rel="noreferrer" target="_blank">three.freeviewnz.tv</a> | 29 | 1300 |<br>
| 1004 | 4 | 1 | Bravo | Bravo | <a href="http://bravo.freeviewnz.tv" rel="noreferrer" target="_blank">bravo.freeviewnz.tv</a> | 29 | 1307 |<br>
| 1005 | 5 | 1 | Whakaata Maori | Whakaata Maori | <a href="http://maori-tv.freeviewnz.tv" rel="noreferrer" target="_blank">maori-tv.freeviewnz.tv</a> | 21 | 1600 |<br>
| 1013 | 6 | 1 | TVNZ DUKE | TVNZ DUKE | <a href="http://tvnz-duke.freeviewnz.tv" rel="noreferrer" target="_blank">tvnz-duke.freeviewnz.tv</a> | 2 | 1205 |<br>
| 1007 | 7 | 1 | TVNZ 2 +1 | TVNZ 2 +1 | <a href="http://tvnz2-plus1.freeviewnz.tv" rel="noreferrer" target="_blank">tvnz2-plus1.freeviewnz.tv</a> | 2 | 1207 |<br>
| 10800 | 8 | 1 | eden | eden | <a href="http://eden.freeviewnz.tv" rel="noreferrer" target="_blank">eden.freeviewnz.tv</a> | 29 | 1303 |<br>
| 1009 | 9 | 1 | Bravo PLUS 1 | Bravo PLUS 1 | <a href="http://bravo-plus1.freeviewnz.tv" rel="noreferrer" target="_blank">bravo-plus1.freeviewnz.tv</a> | 29 | 1308 |<br>
<br>
For ATSC, I believe you would need to replace the "serviceid" field<br>
with "atsc_major_chan,atsc_minor_chan" or probably better something<br>
like this:<br>
<br>
select<br>
chanid,channum,sourceid,callsign,name,xmltvid,mplexid,concat(atsc_major_chan,'_',atsc_minor_chan)<br>
as atsc_chan from channel order by sourceid,channum+0;<br></blockquote><div><br></div><div>Thanks, this is very useful. I got what I needed out of a simple:</div><div>select chanid,channum from channel; but yours is more useful.</div><div><br></div><div>I tried to update my power search record rule to use channum but that failed. So I guess I'll have to run the mysql query and find the chanid from the printout and just plug that into the Power Search. I don't understand it, but it works.</div><div><br></div><div>Jim A<br> </div></div></div>