Change to guide API?

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
djp952
Posts: 490
Joined: Wed Oct 01, 2008 8:46 pm

Change to guide API?

Postby djp952 » Wed Aug 02, 2017 9:07 am

I'm noticing a change today (8/2/17) in the way the Guide API is returning results from the past. Previously the API would return an approximately 8-hour block of programming starting with whatever program falls on the Start time specified, now it's not returning much of anything from the past. If I increase the request closer to current I'll eventually get one program, and then begin getting multiple programs again as I move even closer to current time.

Questions:
Is there now a maximum amount of time you can go backwards when requesting guide data?
Is this a permanent change or a temporary concern?

Example: Ask for data for channel 511 from 8/1/2017 @ 15:46:55 UTC, get nothing:

Code: Select all

[ { "GuideNumber": "511", "GuideName": "WBALDT", "Affiliate": "NBC", "ImageURL": "http://img.hdhomerun.com/tmsimg/h3/NowShowing/28717/s28717_h3_aa.png" } ]

Move the time forward 2 hours and you get one program, albeit one that starts much later (8/2/2017 @ 00:00:00 UTC):

Code: Select all

[ { "GuideNumber": "511", "GuideName": "WBALDT", "Affiliate": "NBC", "ImageURL": "http://img.hdhomerun.com/tmsimg/h3/NowShowing/28717/s28717_h3_aa.png", "Guide": [ { "StartTime": 1501632000, "EndTime": 1501639260, "Title": "America's Got Talent", "EpisodeNumber": "S12E10", "EpisodeTitle": "Judge Cuts 3", "Synopsis": "The contestants have one last chance to impress the judges before going live for America's vote; guest judge Laverne Cox.", "OriginalAirdate": 1501545600, "ImageURL": "http://img.hdhomerun.com/tmsimg/assets/p13949024_b_h3_aa.jpg", "SeriesID": "C187477EN5KRA", "Filter": [ "Comedy" ] } ] } ]


Move the time forward 6 hours, 8/1/2017 @ 21:46:55 UTC in this case, and it seems to work normally again, but the results still start with the program that begins at midnight UTC the next day.

edit: removed API request URLs
Last edited by djp952 on Wed Aug 02, 2017 7:14 pm, edited 1 time in total.

signcarver
Expert
Posts: 7038
Joined: Wed Jan 24, 2007 1:04 am

Re: Change to guide API?

Postby signcarver » Wed Aug 02, 2017 10:28 am

Rule - no storing or archiving guide data or images.

Guide data may be cached for as long as the data is current (typically 1-2 hours).
Images may be cached for up to the cache duration specified in the HTTP header (typically 24 hours).
Images may not be stored within a recorded file.
By the rules, it should have always been like that as stale data is to be discarded (i.e. you can't use data that is no longer valid) Now if you had a show that started 6 hours ago it should return that if you went back 6 hours). What I suspect happened is that SD needs some stale data for themselves to look up issues (i.e FirstAiring being set on the second showing which typically isn't returned by guide anyways) but USERS should never be able to look up stale data. (usually part of the terms in licensing the data).

Originally it was 4 hours, went to 8 temporarily, went back to 4, and rumor has it that it may increase to as much as 24 hours. Also note they don't "publish" guide APIs unless you get permission from them (that is why I generally won't discuss them publicly but yes you can see it in add-on which is GPLd but I feel it is a gray area until documented at https://github.com/Silicondust/documentation/wiki) the only one I will occasionally discuss in public is search.

djp952
Posts: 490
Joined: Wed Oct 01, 2008 8:46 pm

Re: Change to guide API?

Postby djp952 » Wed Aug 02, 2017 12:35 pm

Thanks signcarver, I am aware of the rules :) SD is aware of my project as well, and I've indicated to them that I am aware that it does push the rules and if they ever ask me to change anything I absolutely will. To date they have not come back with anything. I absolutely asked if it was OK prior to implementing the code a month or so ago and was extremely visible about it in the project's thread here.

My question here is regarding a seemingly sudden behavioral change to the API, and if it's something I need to accommodate permanently. There will always likely be a reasonable amount of back-data that can be retrieved, my guess at this point is that they changed from (at least) 24 hours back to something more akin to 8 hours back. There is no point in me changing any code until I know what the expected limits are going to be.

It's also of course possible that the back data was just recently purged from the database for some reason and there is no actual change. Given that I can't get back farther than 00:00 UTC 8/2, that also seems like a reasonable hypothesis :D

nickk
Silicondust
Posts: 14385
Joined: Tue Jan 13, 2004 9:39 am

Re: Change to guide API?

Postby nickk » Wed Aug 02, 2017 3:32 pm

No change to the api... you should get all shows that are currently on and all shows that start within the next 4 hours.
The API will not return shows that have already ended.

Nick

nickk
Silicondust
Posts: 14385
Joined: Tue Jan 13, 2004 9:39 am

Re: Change to guide API?

Postby nickk » Wed Aug 02, 2017 3:51 pm

Looks like there was a bug in one of the checks - fixed.

Nick

djp952
Posts: 490
Joined: Wed Oct 01, 2008 8:46 pm

Re: Change to guide API?

Postby djp952 » Wed Aug 02, 2017 4:01 pm

Thank you!! I will also prevent back requests from exceeding a few hours in the past as well to help address signcarver's concern.

Appreciate it!

nickk
Silicondust
Posts: 14385
Joined: Tue Jan 13, 2004 9:39 am

Re: Change to guide API?

Postby nickk » Wed Aug 02, 2017 4:13 pm

Thank you!! I will also prevent back requests from exceeding a few hours in the past as well to help address signcarver's concern.
Back requests won't work - the API won't return anything that has already ended.

djp952
Posts: 490
Joined: Wed Oct 01, 2008 8:46 pm

Re: Change to guide API?

Postby djp952 » Wed Aug 02, 2017 7:13 pm

Thank you!! I will also prevent back requests from exceeding a few hours in the past as well to help address signcarver's concern.
Back requests won't work - the API won't return anything that has already ended.
Got it, thank you for the information. Everything seems to be working great, I greatly appreciate the timely support on this one sir!


Return to “Development Support”

Who is online

Users browsing this forum: No registered users and 1 guest