DISH Network & ATSC channels

I have been working on a fix for the ATSC channel number assignment issue currently impacting Rollup 2 users.  The scenario is that if you have any channels in the 9000s (like DISH Network) and you have ATSC channels, they will get assigned numbers in the 10000s.  That's a problem if you want to change directly to the channel by typing in its channel number, due to UI restrictions.

Rather than fix the UI, we chose the safer/less impact path of changing how we figure out the channel numbers for the ATSC lineup.  The exact algorithm probably won't be made public, so I can't get too specific, but basically it will work like this:

  1. If the highest non-ATSC channel is less than 9000, use the next block of 1000 numbers after that channel for ATSC.  ATSC channels will get numbers in the format: offset +  major*10 + minor (unless there is a minor>9, in which case they get assigned sequential numbers).  So if the highest non-ATSC is 5001, ATSC channel 13.2 will be 6132.
  2. If there is a non-ATSC channel in the 9000s, search for a free block of numbers within the entire range of channels, preferring larger blocks, and blocks that fall on even multiples of their size (i.e. blockStart % blockSize = 0).  Try fairly hard to keep the major + minor data present as much as possible in the ultimate channel number.
  3. If no blocks of sufficient size are found, assign channel numbers to the ATSC lineup in a first-available way, slotting them into empty numbers as necessary.

The three methods above are tried in order, so if 1 succeeds, 2 and 3 are not used, etc..  Number 3 is very unlikely, absent some boneheaded move by a cable or satellite provider to evenly space their channels throughout the first 10000 numbers.  The most likely is number 1, except for DISH Network users, who get channels in the 9000s right now.

My fondest wish is that we could just ditch channel numbers entirely and be done with it... but we Americans are too attached to them.  For now.