def make_matches_list(params, live=False): """ """ listing = [] matches = comm.list_matches(params, live) for m in matches: li = xbmcgui.ListItem(label=str(m.title), iconImage=m.thumb, thumbnailImage=m.thumb) url = '{0}?action=listmatches{1}'.format(_url, m.make_kodi_url()) is_folder = False li.setProperty('IsPlayable', 'true') li.setInfo('video', {'plot': m.desc, 'plotoutline': m.desc}) listing.append((url, li, is_folder)) if live: upcoming = comm.get_upcoming() for event in upcoming: thumb = os.path.join(addonPath, 'resources', 'soon.jpg') li = xbmcgui.ListItem(event.title, iconImage=thumb) url = '{0}?action=listmatches{1}'.format(_url, event.make_kodi_url()) is_folder = False listing.append((url, li, is_folder)) xbmcplugin.addSortMethod(_handle, sortMethod=xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addDirectoryItems(_handle, listing, len(listing)) xbmcplugin.endOfDirectory(_handle)
def list_matches(params, live=False): """ """ try: listing = [] if not live: matches = comm.list_matches(params, live) else: matches = comm.get_live_matches() for m in matches: li = xbmcgui.ListItem(label=str(m.title), iconImage=m.thumb, thumbnailImage=m.thumb) url = '{0}?action=listmatches{1}'.format(_url, m.make_kodi_url()) is_folder = False li.setProperty('IsPlayable', 'true') li.setInfo('video', {'plot': m.desc, 'plotoutline': m.desc}) listing.append((url, li, is_folder)) if live: upcoming = comm.get_upcoming() for event in upcoming: thumb = os.path.join(addonPath, 'resources', 'soon.jpg') li = xbmcgui.ListItem(event.title, iconImage=thumb) url = '{0}?action=listmatches{1}'.format( _url, event.make_kodi_url()) is_folder = False listing.append((url, li, is_folder)) xbmcplugin.addSortMethod( _handle, sortMethod=xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addDirectoryItems(_handle, listing, len(listing)) xbmcplugin.endOfDirectory(_handle) except Exception: utils.handle_error('Unable to fetch match list')