[mythtv] Channel management, principal design problem?
Michael T. Dean
mtdean at thirdcontact.com
Mon Jul 13 20:14:55 UTC 2009
On 07/13/2009 02:02 PM, Peter Brouwer wrote:
> Would like to understand if I got the correct picture.
> Channel management ( selection, scanning, etc etc) seems to be done
> via the channel number.
> The problem I have found is that when using multiple sources ( for
> instance scanning a few satelites)that the channel number is not
> guaranteed to contain a unique value.
Not a problem for Myth.
> At the end of the scanning process myth complains about this when
> finding channels using the same number.
I think you're misinterpreting the error message. Pasting the exact
error message and your version (mythbackend --version) into a post on
the mythtv-users list :) would make it easier to explain its meaning to you.
> I see this as a serious principal design flaw. The channel number
> should not be used by myth to uniquely identify a channel from the
> list of channels in the database. I suspect that the chanid field is a
> better identifier to be used for that. Am I right in my conclusion? If
> so should this be filed as a design bug?
> What scares me that if I do a search on channum, is the wide spread
> use of that field over various places in the code. It does not seem to
> be isolated and abstracted from other pieces of code.
In MythTV, the chanid is used to uniquely identify channels. It is not
a user-editable field (can only be edited by circumventing the
application--including the application's data integrity checks--and
editing the database directly--without any data integrity checks--which
is likely to break your configuration).
The channel number, however, is a user-editable field that means
/absolutely/ nothing to MythTV. Its /only/ purpose is to allow a user
to switch /directly/ to the desired channel in LiveTV by typing in the
channel number. If you never use LiveTV, your channel numbers can be
/anything/ you want. You could even set every single channel number to
the exact same value. However, when in LiveTV, typing in a channel
number that's duplicated on multiple (distinct) channels means that you
can not directly tune the desired channel by typing in a number--you'll
have to use the EPG or browse mode to switch to the desired channel.
The channel callsign, on the other hand, is actually used by MythTV, but
is also a user-editable field. MythTV requires that the channel
callsign be distinct for every channel whose content is not
"substantially identical." (What "substantially identical" means is
very subjective, but if the content is not /exactly/ identical, your
best bet is to use different callsigns for the channels.) Any channels
with the same callsign are considered to be equivalent when scheduling
recordings using the "this channel" rules. If you never use "this
channel" rules, having improper callsigns would not cause any visible
problems (however, it would mean your channels are configured
incorrectly, so all users should define them properly). Note, also,
that even though some countries have no concept of government-assigned
callsigns, users in those areas still /must/ specify appropriate
callsigns, for "this channel" rules to work properly (i.e. ignore the
seemingly-US-centric name of the field). The callsign can be /any/
value with up to 10 characters, and its purpose is simply to identify
channels with "substantially identical" content (regardless of the name
used for the field).
Both channel number and channel callsign can be edited using the
mythtv-setup or MythWeb channel editors.
In addition, when 2 channels have identical channel numbers and
callsigns, the MythTV EPG displays only one copy of the channel--i.e. as
the 2 channels would be listed next to each other (because of the same
channel number) and their content would be identical (as specified by
the identical callsign), so there's no reason to duplicate the row in
As I don't know which error message you saw and I don't know what
version of Myth you're using, I can't tell you exactly what Myth is
trying to tell you. However, the most important point in this reply is
that, "The channel number ... is a user-editable field," so go through
and change the value to anything you like--what's put there when
scanning need not stay there.
Note, also, that the channel scanner often--because the stream does
/not/ contain channel number info--has to make up a channel number. The
code for choosing the value to use isn't ideal (and has some minor
issues). However, the channel scanner in Myth is being completely
rewritten, and the new channel scanner will do much better at choosing
appropriate values for channel numbers when the streams don't provide
them. If you happen to have a bunch of channels whose numbers end up
the same but you want them to be different, just edit them. If you
happen to have 10,000 radio channels that all have the same channel
number, you can backup your database (
http://www.mythtv.org/wiki/Database_Backup_and_Restore ) and then, using
the mysql command-line client:
SET @row = 0
UPDATE falsechannel SET channum = (SELECT @row := @row + 1);
(change falsechannel to channel to make it actually work--just a
precaution for the copy/paste trigger happy).
Please follow up with any discussion on the issue or the problems you're
seeing on the mythtv-users list.
More information about the mythtv-dev