A
Anonymous
Guest
So I'm looking into the "why do I have to manually enter the frequencies for every channel I want to watch" problem and I'm trying to wrap my head around how the TVChannel object / database / AnalogTVTuningForm / et all works.
Q 1: In TV.Recording.TVCaptureDevice.GetChannelNr(), and everywhere channels are needed for that matter, why do we get an untyped ArrayList of TVChannel objects only to try to find one in the list that matches? Wouldn't it make more sense to do
Q 2: Couldn't all areas (ChannelUp, ChannelDown, etc) benefit from using TVChannel objects and calling functions like TVDatabase.GetNextChannel(TVChannel chanCurrent). Getting and searching an ArrayList every time seems like overkill when you can just select the single Channel you want to begin with.
Q 3: Why does AnalogTVTuningForm not store the frequency into the channels database in while it is adding the channel number? I assume that the frequency in the database is an override rather than what is actually going to be used to tune the channel, right? Would me adding code to store both the channel number and frequency (and also automapping as many as possible before requiring user interaction) mess things up further down the line?
I'm currently an XBMC and MythTV user, and a very experienced programmer. If I'm not going to be stepping on any toes, or breaking any future plans, I'd be happy to help out. I just need to make sure I understand why things need to be the way they are if there are reasons.
Q 1: In TV.Recording.TVCaptureDevice.GetChannelNr(), and everywhere channels are needed for that matter, why do we get an untyped ArrayList of TVChannel objects only to try to find one in the list that matches? Wouldn't it make more sense to do
Code:
TVChannel chan = TVDatabase.GetChannelByName(strChannelName);
if (chan != null)
{
if (chan.Number <= 0) ...
standard = chan.TVStandard;
return chan.Number;
}
...
TVDatabase:
static public TVChannel GetChannelByName(string strChannelName)
{
... // similar setup to GetChannels
strSQL = String.Format("SELECT * FROM channel WHERE strChannel = '{0}'", strChannelName);
... // execute, build single object and return
}
Q 2: Couldn't all areas (ChannelUp, ChannelDown, etc) benefit from using TVChannel objects and calling functions like TVDatabase.GetNextChannel(TVChannel chanCurrent). Getting and searching an ArrayList every time seems like overkill when you can just select the single Channel you want to begin with.
Q 3: Why does AnalogTVTuningForm not store the frequency into the channels database in while it is adding the channel number? I assume that the frequency in the database is an override rather than what is actually going to be used to tune the channel, right? Would me adding code to store both the channel number and frequency (and also automapping as many as possible before requiring user interaction) mess things up further down the line?
I'm currently an XBMC and MythTV user, and a very experienced programmer. If I'm not going to be stepping on any toes, or breaking any future plans, I'd be happy to help out. I just need to make sure I understand why things need to be the way they are if there are reasons.