Hi guys,
first of all, let me thank you for all the great work you are doing on MediaPortal!
Right, I am writing a small controlling application that controls TVServer remotely and acts as a proxy to other less powerful machines. In order to get information out such as the EPG for one or more channels at a specified time I make use of the GetProgramAt() method in the Channel class. So far so good.
Now, the way the method constructs its SQL statement results in something like this:
As you can see, the method will return ANY program entry available as long as the endTime is greater or equal to the requested date. This would normally work for a perfectly formed Program DB table; but if the EPG retrieval has downloaded programs that are further in the future than the requested date, and not a single one that actually matches the requested date, this method returns a false positive!
So, if I have a program for say 26/01/2007 in the database, and nothing else for that channel, and I call GetProgramAt() for the 16/01/2007, it will return the program on the 26th as the result, even though this is 10 days in the future!
This is all probably my misinterpretation of what the method should do, but surely if there is no program "at" the specified DateTime in the database, the result should be "null". That way an EPG generation routine could simply display that there is no information available for the requested DateTime.
So perhaps a slightly more ellaborate SQL statement determining the one program whose [startTime, endTime] surrounds the requested date would be a more accurate way of doing things. I'm sure there are performance reasons why you guys decided to implement this method as it currently is, if so please let me know so I can just write a little workaround on the application side instead
Anyway, just my 2 pence worth of comments
Thanks again for a great piece of work!
AL
first of all, let me thank you for all the great work you are doing on MediaPortal!
Right, I am writing a small controlling application that controls TVServer remotely and acts as a proxy to other less powerful machines. In order to get information out such as the EPG for one or more channels at a specified time I make use of the GetProgramAt() method in the Channel class. So far so good.
Now, the way the method constructs its SQL statement results in something like this:
Code:
select top 1 idProgram, idChannel, startTime, endTime, title, description, genre, notify from Program where idChannel = @idChannel and endTime >= '20070116 14:01:54' order by startTime asc
As you can see, the method will return ANY program entry available as long as the endTime is greater or equal to the requested date. This would normally work for a perfectly formed Program DB table; but if the EPG retrieval has downloaded programs that are further in the future than the requested date, and not a single one that actually matches the requested date, this method returns a false positive!
So, if I have a program for say 26/01/2007 in the database, and nothing else for that channel, and I call GetProgramAt() for the 16/01/2007, it will return the program on the 26th as the result, even though this is 10 days in the future!
This is all probably my misinterpretation of what the method should do, but surely if there is no program "at" the specified DateTime in the database, the result should be "null". That way an EPG generation routine could simply display that there is no information available for the requested DateTime.
So perhaps a slightly more ellaborate SQL statement determining the one program whose [startTime, endTime] surrounds the requested date would be a more accurate way of doing things. I'm sure there are performance reasons why you guys decided to implement this method as it currently is, if so please let me know so I can just write a little workaround on the application side instead
Anyway, just my 2 pence worth of comments
Thanks again for a great piece of work!
AL