home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Channel.GetProgramAt() Issue
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="drfonz" data-source="post: 105182" data-attributes="member: 26014"><p>Hi guys,</p><p></p><p>first of all, let me thank you for all the great work you are doing on MediaPortal!</p><p></p><p>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 <span style="color: RoyalBlue"><strong>GetProgramAt()</strong></span> method in the <strong><span style="color: RoyalBlue">Channel </span></strong>class. So far so good.</p><p></p><p>Now, the way the method constructs its SQL statement results in something like this:</p><p></p><p>[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</p><p>[/CODE]</p><p></p><p>As you can see, the method will return ANY program entry available as long as the <strong><span style="color: RoyalBlue">endTime </span></strong>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!</p><p></p><p>So, if I have a program for say 26/01/2007 in the database, and nothing else for that channel, and I call <strong><span style="color: RoyalBlue">GetProgramAt() </span></strong>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! </p><p></p><p>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. </p><p></p><p>So perhaps a slightly more ellaborate SQL statement determining the one program whose <span style="color: RoyalBlue"><strong>[startTime, endTime]</strong></span> 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 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>Anyway, just my 2 pence worth of comments <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>Thanks again for a great piece of work!</p><p>AL</p></blockquote><p></p>
[QUOTE="drfonz, post: 105182, member: 26014"] 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 [COLOR="RoyalBlue"][B]GetProgramAt()[/B][/COLOR] method in the [B][COLOR="RoyalBlue"]Channel [/COLOR][/B]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 [/CODE] As you can see, the method will return ANY program entry available as long as the [B][COLOR="RoyalBlue"]endTime [/COLOR][/B]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 [B][COLOR="RoyalBlue"]GetProgramAt() [/COLOR][/B]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 [COLOR="RoyalBlue"][B][startTime, endTime][/B][/COLOR] 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 [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Channel.GetProgramAt() Issue
Contact us
RSS
Top
Bottom