def make_category_list(): try: iview_config = comm.get_config() categories = comm.get_categories(iview_config) categories = sorted(categories, key=lambda k: k['name'].lower()) # All category is disabled for now due to API issues # https://github.com/andybotting/xbmc-addon-abc-iview/issues/1454 #categories.insert(0, {'name':'All', 'keyword':'0-z'}) ok = True for g in categories: url = "%s?category=%s" % (sys.argv[0], g['keyword']) listitem = xbmcgui.ListItem(g['name']) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: utils.handle_error()
def make_category_list(): try: iview_config = comm.get_config() categories = comm.get_categories(iview_config) categories = sorted(categories, key=lambda k: k['name'].lower()) categories.insert(0, {'name': 'All', 'keyword': '0-z'}) ok = True for g in categories: url = "%s?category_id=%s" % (sys.argv[0], g['keyword']) listitem = xbmcgui.ListItem(g['name']) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: d = xbmcgui.Dialog() message = utils.dialog_error("Unable to fetch listing") d.ok(*message) utils.log_error()
def make_category_list(): try: iview_config = comm.get_config() categories = comm.get_categories(iview_config) categories = sorted(categories, key=lambda k: k['name'].lower()) categories.insert(0, {'name':'All', 'keyword':'0-z'}) ok = True for g in categories: url = "%s?category=%s" % (sys.argv[0], g['keyword']) listitem = xbmcgui.ListItem(g['name']) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: utils.handle_error()
def make_category_list(): try: categories = comm.get_categories() categories = sorted(categories, key=lambda k: k['name'].lower()) ok = True for g in categories: url = "%s?category=%s" % (sys.argv[0], g['path']) listitem = xbmcgui.ListItem(g['name']) if 'thumbnail' in g: listitem.setArt({'thumb': g['thumbnail']}) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except Exception: utils.handle_error('Unable to build category list')
def make_category_list(): try: categories = comm.get_categories() categories = sorted(categories, key=lambda k: k['name'].lower()) categories.append({'path': 'settings', 'name': 'Settings'}) ok = True for g in categories: url = "%s?category=%s" % (sys.argv[0], g['path']) listitem = xbmcgui.ListItem(g['name']) if 'thumbnail' in g: listitem.setArt({'thumb': g['thumbnail']}) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except Exception: utils.handle_error('Unable to build category list')
def make_categories_list(): utils.log('Showing category list') try: categories_list = comm.get_categories() categories_list.sort() categories_list.insert(0, classes.Category(title='Live TV')) categories_list.append(classes.Category(title='Settings')) for c in categories_list: url = '{0}?action=list_categories&{1}'.format(sys.argv[0], c.make_kodi_url()) listitem = xbmcgui.ListItem(label=c.title, iconImage=c.get_thumb(), thumbnailImage=c.get_thumb()) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') except Exception: utils.handle_error("Unable to show category listing")
def get_categories(): iview_config = comm.get_config() categories = comm.get_categories(iview_config) return categories