Hello everybody,
I’m working on the LetMeStream Channel (forums.plex.tv/discussion/212686/rel-letmestream-channel#latest)
I have to make several call using HTTP.Request (basically, urls have offsets) to retrieve data.
I make a loop on it, but sometimes, there is too many call and channel time out (after refresh, with the cache it’s ok)
How can i add objects to ObjectContainer asynchronous (continue to add objects after the return) ?
Any idea with this kind of code?
@route(PREFIX + ‘/TvShows’)
def GetTvShows():
oc = ObjectContainer()
url = ‘http://blablablabla?offset=XX’
offset = 0
items = JSON.ObjectFromString(HTTP.Request(url, cacheTime = CACHE_1DAY).content)[‘items’]
while len(items) > 0:
for item in items]:
oc.add(...)
offset += len(items)
url = 'http://blablablabla?offset=' + str(offset)
items = JSON.ObjectFromString(HTTP.Request(url, cacheTime = CACHE_1DAY).content)['items']
return oc
Thanks in advance 