def make_programs_list(url): try: params = utils.get_url(url) programs = comm.get_series(params["series_id"]) ok = True for p in programs: listitem = xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.get_thumbnail(), thumbnailImage=p.get_thumbnail()) listitem.setInfo('video', p.get_xbmc_list_item()) if hasattr(listitem, 'addStreamInfo'): listitem.addStreamInfo('audio', p.get_xbmc_audio_stream_info()) listitem.addStreamInfo('video', p.get_xbmc_video_stream_info()) # Build the URL for the program, including the list_info url = "%s?program_id=%s" % (sys.argv[0], p.id) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False, totalItems=len(programs)) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: d = xbmcgui.Dialog() msg = utils.dialog_error("Unable to fetch listing") d.ok(*msg) utils.log_error()
def make_programs_list(url): try: params = utils.get_url(url) programs = comm.get_series(params["series_id"]) num_programs = len(programs) ok = True for p in programs: # Don't show any 'promo' shows. They don't get returned by Brightcove if p.duration and p.duration < 1000: utils.log("Skipping program %s (duration <19 mins)" % p.get_list_title()) num_programs -= 1 continue listitem = xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.get_thumbnail(), thumbnailImage=p.get_thumbnail()) listitem.setInfo('video', p.get_xbmc_list_item()) if hasattr(listitem, 'addStreamInfo'): listitem.addStreamInfo('audio', p.get_xbmc_audio_stream_info()) listitem.addStreamInfo('video', p.get_xbmc_video_stream_info()) # Build the URL for the program, including the list_info url = "%s?program_id=%s" % (sys.argv[0], p.id) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False, totalItems=num_programs) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: utils.handle_error("Unable to fetch program listing")
def make_programs_list(url): try: params = utils.get_url(url) programs = comm.get_series(params["series_id"]) ok = True for p in programs: listitem = xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.get_thumbnail(), thumbnailImage=p.get_thumbnail()) listitem.setInfo('video', p.get_xbmc_list_item()) if hasattr(listitem, 'addStreamInfo'): listitem.addStreamInfo('audio', p.get_xbmc_audio_stream_info()) listitem.addStreamInfo('video', p.get_xbmc_video_stream_info()) # Build the URL for the program, including the list_info url = "%s?program_id=%s" % (sys.argv[0], p.id) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False, totalItems=len(programs)) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: d = xbmcgui.Dialog() msg = utils.dialog_error("Unable to fetch listing") d.ok(*msg) utils.log_error();
def make_programs_list(url): params = utils.get_url(url) try: program_list = comm.get_series(params["series_id"]) # fill media list ok = fill_programs_list(program_list) except: # oops print error message d = xbmcgui.Dialog() msg = utils.dialog_error("Unable to fetch listing") d.ok(*msg) utils.log_error(); ok = False # send notification we're finished, successfully or unsuccessfully xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok)
def make_programs_list(url): params = utils.get_url(url) try: program_list = comm.get_series(params["series_id"]) # fill media list ok = fill_programs_list(program_list) except: # oops print error message d = xbmcgui.Dialog() msg = utils.dialog_error("Unable to fetch listing") d.ok(*msg) utils.log_error() ok = False # send notification we're finished, successfully or unsuccessfully xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok)
def make_programs_list(url): try: params = utils.get_url(url) programs = comm.get_series(params["series_id"]) num_programs = len(programs) ok = True for p in programs: # Don't show any 'promo' shows. They don't get returned by Brightcove if p.duration < 1200: utils.log("Skipping program %s (duration <20 mins)" % p.get_list_title()) num_programs -= 1 continue listitem = xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.get_thumbnail(), thumbnailImage=p.get_thumbnail()) listitem.setInfo('video', p.get_xbmc_list_item()) if hasattr(listitem, 'addStreamInfo'): listitem.addStreamInfo('audio', p.get_xbmc_audio_stream_info()) listitem.addStreamInfo('video', p.get_xbmc_video_stream_info()) # Build the URL for the program, including the list_info url = "%s?program_id=%s" % (sys.argv[0], p.id) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False, totalItems=num_programs) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: utils.handle_error("Unable to fetch program listing")