def __listStreams(params): eventsObj = db['events'] streams = hockeystreams.eventStreams(params, eventsObj, True if mode == common.Mode.STREAMS_REFRESH else False) db['events'] = eventsObj # write back to db for stream in streams: common.addDirItem(stream.getTitle(), stream.src, 'DefaultVideo.png', '') params = {'homeTeam': params['homeTeam'], 'awayTeam': params['awayTeam'], 'mode': common.Mode.STREAMS_REFRESH} # params.update({'mode': common.Mode.STREAMS_REFRESH}) common.addDirItem('Refresh', '', 'DefaultFolder.png', params)
def __listEvents(settingsObj, loginObj): try: eventsObj = db['events'] except: eventsObj = hockeystreams.Events(loginObj.token) pass events = hockeystreams.liveEvents(settingsObj, eventsObj, True if mode == common.Mode.EVENTS_REFRESH else False) db['events'] = eventsObj # write back to db for teams, subEvents in events: eventGroup = list(subEvents) homeEvent = eventGroup[0][2] params = {'homeTeam': homeEvent.homeTeam, 'awayTeam': homeEvent.awayTeam, 'token': loginObj.token, 'mode': common.Mode.STREAMS} common.addDirItem(homeEvent.getTitle(settingsObj.showscores), '', common.__addonpath__+'/resources/images/'+homeEvent.event+'.png', params) params = {'mode': common.Mode.EVENTS_REFRESH} common.addDirItem('Refresh', '', 'DefaultFolder.png', params)