Past airings

17 views
Skip to first unread message

Brian Schneider

unread,
Aug 20, 2011, 9:30:01 AM8/20/11
to sagetv-b...@googlegroups.com
I've implemented the new future airings functionality and things work great there (uses the Sage API GetAiringsForShow() call).  The only issue with that call is it gets airings AFTER the specified time that you pass in.  I'd like to do the opposite, to get airings BEFORE the specified time.

Future Airings (from airings.xml):
items = airings.airingsToListItems(sageAPI.GetAiringsForShow(show, startingAfterTime), sageAPI)

Is there a way to use this functionality, but perhaps pass in a filter that says give me all airings BETWEEN the beginning of time and up to the Airing's start time?


Derek Battams

unread,
Aug 20, 2011, 10:50:05 AM8/20/11
to sagetv-b...@googlegroups.com
GetAiringsForShow() only returns airings of the specific episode; not all episodes of the show title in the EPG.  So you should search by exact title, which is what I believe the default STV does in Sage.  Unfortunately, it's a little messy for us using the remote APIs, but quite doable.

So, to get all airings of a show, I'd do this (I'm using the show var you introduced, I assume it's a Show JSON object previously loaded from somewhere):

items = airings.airingsToListItems(sageAPI.SearchByTitle(show['ShowTitle'], 'T'))

Now if you only want airings from the past, do this:

expr = 'FilterByRange(SearchByTitle("%s", "T"), "GetAiringStartTime", java_lang_Long_parseLong("0"), java_lang_Long_parseLong("%d"), true)' % (show['ShowTitle'], int(time.time()) * 1000)
items = airings.airingsToListItems(sageAPI.EvaluateExpression(expr))

For airings in the future:

expr = 'FilterByRange(SearchByTitle("%s", "T"), "GetAiringStartTime", java_lang_Long_parseLong("%d"), java_lang_Long_MAX_VALUE, true)' % (show['ShowTitle'], int(time.time()) * 1000)
items = airings.airingsToListItems(sageAPI.EvaluateExpression(expr))

Apply a filter to the EvaluateExpression() call to restrict the properties that are returned, if necessary.  My guess is you'll want to add these as custom methods in sage.py for easier access throughout the UI.

  - Derek


--
You received this message because you are subscribed to the Google Groups "SageTV for Boxee (Development)" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sagetv-boxee-dev/-/-1QiQj9GCEoJ.
To post to this group, send email to sagetv-b...@googlegroups.com.
To unsubscribe from this group, send email to sagetv-boxee-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sagetv-boxee-dev?hl=en.

Brian Schneider

unread,
Aug 20, 2011, 11:38:00 AM8/20/11
to sagetv-b...@googlegroups.com
Thanks... makes sense.  And how do I sort the results that are returned, perhaps in order by oldest to newest based on airingstarttime?

Brian Schneider

unread,
Aug 20, 2011, 11:42:29 AM8/20/11
to sagetv-b...@googlegroups.com
Ignore previous post re: sort, figured it out based on what was in recordings.xml (using Sage's Sort API method)

Brian Schneider

unread,
Aug 20, 2011, 11:57:56 AM8/20/11
to sagetv-b...@googlegroups.com
Checked in r117 with improvements to future airings plus added past airings.  That's all from me for today.
Reply all
Reply to author
Forward
0 new messages