google / sagetv

SageTV is a cross-platform networked DVR and media management system
http://forums.sagetv.com/
Apache License 2.0
267 stars 174 forks source link

New API Methods for In Progress Sport Events. #250

Closed enternoescape closed 7 years ago

enternoescape commented 7 years ago

Schedules Direct provides an API for in progress sports for many professional sports (NFL, NHL, NBA and MLB). The SageTV community already has a plugin (SRE) that provides this kind of functionality, but I believe that this Schedules Direct data would be easier than scraping websites like we currently do with SRE since anything that's covered by Schedules Direct would not require constant upkeep as the websites change. There appears to already be some interest in making this accessible, so I'm opening this issue to help me understand what the developers of SRE would find most useful. These are the ideas I have:

// Returns true if Schedules Direct is configured and authenticating on the current SageTV server.
boolean IsSDEPGServiceAvailable()

// Returns true for each item in the array that can be tracked.
boolean[] IsSDEPGInProgressSport(String[] ExternalIDs)

// Returns a number value for each item in the array that correlates with the current status of
// the in progress sport events.
// 0 = Complete
// 1 = In progress
// 2 = Status is not available at the moment (try again in 30 seconds)
// 3 = Program is in the future and will be able to be tracked
// 4 = Program is not trackable
// 5 = Schedules Direct is offline/not available right now (try again in an hour)
// 6 = Schedules Direct authentication failure
// 7 = General failure
int[] GetSDEPGInProgressSportStatus(String[] ExternalIDs)
Narflex commented 7 years ago

This is awesome that they provide that service....definitely better to do it that way than via website scraping. :D

On Mon, Jan 16, 2017 at 7:54 AM, Joseph Shuttlesworth < notifications@github.com> wrote:

Schedules Direct provides an API for in progress sports https://github.com/SchedulesDirect/JSON-Service/wiki/API-20141201#downloading-in-progress-for-sporting-events for many professional sports (NFL, NHL, NBA and MLB). The SageTV community already has a plugin (SRE) that provides this kind of functionality, but I believe that this Schedules Direct data would be easier than scraping websites like we currently do with SRE since anything that's covered by Schedules Direct would not require constant upkeep as the websites change. There appears to already be some interest in making this accessible, so I'm opening this issue to help me understand what the developers of SRE would find most useful. These are the ideas I have:

// Returns true if Schedules Direct is configured and authenticating on the current SageTV server. boolean SDEPGServiceAvailable()

// Returns true for each item in the array that can be tracked. boolean[] SDEPGCanInProgressSport(String ExternalID[])

// Returns a number value for each item in the array that correlates with the current status of // the in progress sport events. // 0 = Complete // 1 = In progress // 2 = Status is not available at the moment (try again in 30 seconds) // 3 = Program is in the future // 4 = Program is not trackable // 5 = Schedules Direct is offline/not available right now (try again in an hour) // 6 = Schedules Direct authentication failure int[] SDEPGInProgressSportStatus(String ExternalID[])

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/sagetv/issues/250, or mute the thread https://github.com/notifications/unsubscribe-auth/ANEIDKqGjdvWdCRLgbYvNTb0VYc1y0wpks5rS5KhgaJpZM4LktQr .

-- Jeffrey Kardatzke jkardatzke@google.com Google, Inc.

wayner9 commented 7 years ago

I would add a field for "program is in the future and is trackable" - perhaps this is what you meant by entry 3? Or perhaps this sort of information is not available from SD?

enternoescape commented 7 years ago

I changed 3 to: Program is in the future and will be trackable

That's what it really means.

enternoescape commented 7 years ago

@skiingwiz I think you're the current maintainer of SRE. Is there anything more you would like in the API or would like to have changed?

skiingwiz commented 7 years ago

@enternoescape That API seems to cover everything that SRE would need.

Is there any rate limit or penalty for querying from SD? The way SRE is currently architected each recording is queried independently. It wouldn't be very difficult to batch up the queries to hit the API once instead of once per recording.

enternoescape commented 7 years ago

Not that I'm aware of. The API from SD actually only does one at a time. I was batching them up because it speeds up a few internal checks and gives us some options for optimization later if needed. Submitting 1 element arrays should be fine. In fact, if I read how SageTV does String array conversions correctly, you can just submit the element without being in an array and SageTV will make it an array.

enternoescape commented 7 years ago

I made a few subtle changes to the methods after looking at other API functions to try and keep thing consistent.

enternoescape commented 7 years ago

@skiingwiz It sounds like we will be seeing at least a new Windows build this upcoming weekend, so hopefully you'll get a chance to play with the new API soon (if you didn't compile a copy for yourself already).