def make_programs_list(url): try: params = utils.get_url(url) iview_config = comm.get_config() programs = comm.get_series_items(iview_config, 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?play=true&%s" % (sys.argv[0], p.make_xbmc_url()) # 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_series_list(url): params = utils.get_url(url) try: iview_config = comm.get_config() series_list = comm.get_programme(iview_config, params["category_id"]) series_list.sort() ok = True for s in series_list: url = "%s?series_id=%s" % (sys.argv[0], s.id) thumbnail = s.get_thumbnail() listitem = xbmcgui.ListItem(s.get_list_title(), iconImage=thumbnail, thumbnailImage=thumbnail) listitem.setInfo('video', {'plot': s.get_description()}) # add the item to the media 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='tvshows') except: d = xbmcgui.Dialog() message = utils.dialog_error("Unable to fetch listing") d.ok(*message) utils.log_error()
def play(url): iview_config = comm.get_config() auth = comm.get_auth(iview_config) p = classes.Program() p.parse_xbmc_url(url) try: # Playpath shoud look like this: # Akamai: mp4:flash/playback/_definst_/itcrowd_10_03_02 playpath = auth['playpath_prefix'] + p.url if playpath.split('.')[-1] == 'mp4': playpath = 'mp4:' + playpath # Strip off the .flv or .mp4 playpath = playpath.split('.')[0] # rtmp://cp53909.edgefcs.net/ondemand?auth=daEbjbeaCbGcgb6bedYacdWcsdXc7cWbDda-bmt0Pk-8-slp_zFtpL&aifp=v001 # playpath=mp4:flash/playback/_definst_/kids/astroboy_10_01_22 swfurl=http://www.abc.net.au/iview/images/iview.jpg swfvfy=true rtmp_url = "%s?auth=%s playpath=%s swfurl=%s swfvfy=true" % (auth['rtmp_url'], auth['token'], playpath, config.swf_url) listitem=xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.thumbnail, thumbnailImage=p.thumbnail) listitem.setInfo('video', p.get_xbmc_list_item()) xbmc.Player().play(rtmp_url, listitem) except: # user cancelled dialog or an error occurred d = xbmcgui.Dialog() d.ok('ABC iView Error', 'ABC iView encountered an error:', ' %s (%d) - %s' % (sys.exc_info()[ 2 ].tb_frame.f_code.co_name, sys.exc_info()[ 2 ].tb_lineno, sys.exc_info()[ 1 ]) ) return None print "ERROR: %s (%d) - %s" % ( sys.exc_info()[ 2 ].tb_frame.f_code.co_name, sys.exc_info()[ 2 ].tb_lineno, sys.exc_info()[ 1 ], )
def fill_series_list(series_list): iview_config = comm.get_config() try: ok = True # enumerate through the list of categories and add the item to the media list for s in series_list: url = "%s?series_id=%s" % (sys.argv[0], s.id) thumbnail = s.get_thumbnail() listitem = xbmcgui.ListItem(s.get_list_title(), iconImage=thumbnail, thumbnailImage=thumbnail) listitem.setInfo('video', {'plot': s.get_description()}) # add the item to the media list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True, totalItems=len(series_list)) # if user cancels, call raise to exit loop if (not ok): raise xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') except: # user cancelled dialog or an error occurred utils.log_error() ok = False return ok
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_series_list(url): params = utils.get_url(url) try: iview_config = comm.get_config() series_list = comm.get_programme(iview_config, params["category_id"]) series_list.sort() ok = True for s in series_list: url = "%s?series_id=%s" % (sys.argv[0], s.id) thumbnail = s.get_thumbnail() listitem = xbmcgui.ListItem(s.get_list_title(), iconImage=thumbnail, thumbnailImage=thumbnail) listitem.setInfo('video', { 'plot' : s.get_description() }) # add the item to the media 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='tvshows') except: d = xbmcgui.Dialog() message = utils.dialog_error("Unable to fetch listing") d.ok(*message) utils.log_error();
def fill_category_list(category_list): iview_config = comm.get_config() try: ok = True # enumerate through the list of categories and add the item to the media list for g in category_list: url = "%s?category_id=%s" % (sys.argv[0], g['keyword']) listitem = xbmcgui.ListItem(g['name']) # add the item to the media list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True, totalItems=len(category_list)) # if user cancels, call raise to exit loop if (not ok): raise except: # user cancelled dialog or an error occurred utils.log_error() ok = False return ok
def fill_series_list(series_list): iview_config = comm.get_config() try: ok = True # enumerate through the list of categories and add the item to the media list for s in series_list: url = "%s?series_id=%s" % (sys.argv[0], s.id) thumbnail = s.get_thumbnail() listitem = xbmcgui.ListItem(s.get_list_title(), iconImage=thumbnail, thumbnailImage=thumbnail) listitem.setInfo('video', { 'plot' : s.get_description() }) # add the item to the media list ok = xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True, totalItems=len(series_list) ) # if user cancels, call raise to exit loop if (not ok): raise xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') except: # user cancelled dialog or an error occurred utils.log_error() ok = False return ok
def make_programs_list(url): try: params = utils.get_url(url) iview_config = comm.get_config() programs = comm.get_series_items(iview_config, 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?play=true&%s" % (sys.argv[0], p.make_xbmc_url()) # 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 fill_category_list(category_list): iview_config = comm.get_config() try: ok = True # enumerate through the list of categories and add the item to the media list for g in category_list: url = "%s?category_id=%s" % (sys.argv[0], g['keyword']) listitem = xbmcgui.ListItem(g['name']) # add the item to the media list ok = xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True, totalItems=len(category_list) ) # if user cancels, call raise to exit loop if (not ok): raise except: # user cancelled dialog or an error occurred utils.log_error() ok = False return ok
def play(url): iview_config = comm.get_config() auth = comm.get_auth(iview_config) p = classes.Program() p.parse_xbmc_url(url) try: # Playpath shoud look like this: # Akamai: mp4:flash/playback/_definst_/itcrowd_10_03_02 playpath = auth['playpath_prefix'] + p.url if playpath.split('.')[-1] == 'mp4': playpath = 'mp4:' + playpath # Strip off the .flv or .mp4 playpath = playpath.split('.')[0] # rtmp://cp53909.edgefcs.net/ondemand?auth=daEbjbeaCbGcgb6bedYacdWcsdXc7cWbDda-bmt0Pk-8-slp_zFtpL&aifp=v001 # playpath=mp4:flash/playback/_definst_/kids/astroboy_10_01_22 swfurl=http://www.abc.net.au/iview/images/iview.jpg swfvfy=true rtmp_url = "%s?auth=%s playpath=%s swfurl=%s swfvfy=true" % (auth['rtmp_url'], auth['token'], playpath, config.swf_url) listitem=xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.thumbnail, thumbnailImage=p.thumbnail) listitem.setInfo('video', p.get_xbmc_list_item()) xbmc.Player().play(rtmp_url, listitem) except: # oops print error message d = xbmcgui.Dialog() message = utils.dialog_error("Unable to play video") d.ok(*message) utils.log_error();
def parse_auth(soup): """ There are lots of goodies in the auth handshake we get back, but the only ones we are interested in are the RTMP URL, the auth token, and whether the connection is unmetered. """ xml = BeautifulStoneSoup(soup) # should look like "rtmp://203.18.195.10/ondemand" rtmp_url = xml.find('server').string # at time of writing, either 'Akamai' (usually metered) or 'Hostworks' (usually unmetered) stream_host = xml.find('host').string if stream_host == 'Akamai': playpath_prefix = config.akamai_playpath_prefix else: playpath_prefix = '' if rtmp_url is not None: # Being directed to a custom streaming server (i.e. for unmetered services). # Currently this includes Hostworks for all unmetered ISPs except iiNet. rtmp_chunks = rtmp_url.split('/') rtmp_host = rtmp_chunks[2] rtmp_app = rtmp_chunks[3] else: # We are a bland generic ISP using Akamai, or we are iiNet. if not comm.iview_config: comm.get_config() rtmp_url = comm.iview_config['rtmp_url'] rtmp_host = comm.iview_config['rtmp_host'] rtmp_app = comm.iview_config['rtmp_app'] token = xml.find("token").string token = token.replace('&', '&') # work around BeautifulSoup bug return { 'rtmp_url': rtmp_url, 'rtmp_host': rtmp_host, 'rtmp_app': rtmp_app, 'playpath_prefix': playpath_prefix, 'token': token, 'free': (xml.find("free").string == "yes") }
def parse_auth(soup): """ There are lots of goodies in the auth handshake we get back, but the only ones we are interested in are the RTMP URL, the auth token, and whether the connection is unmetered. """ xml = BeautifulStoneSoup(soup) # should look like "rtmp://203.18.195.10/ondemand" rtmp_url = xml.find('server').string # at time of writing, either 'Akamai' (usually metered) or 'Hostworks' (usually unmetered) stream_host = xml.find('host').string if stream_host == 'Akamai': playpath_prefix = config.akamai_playpath_prefix else: playpath_prefix = '' if rtmp_url is not None: # Being directed to a custom streaming server (i.e. for unmetered services). # Currently this includes Hostworks for all unmetered ISPs except iiNet. rtmp_chunks = rtmp_url.split('/') rtmp_host = rtmp_chunks[2] rtmp_app = rtmp_chunks[3] else: # We are a bland generic ISP using Akamai, or we are iiNet. if not comm.iview_config: comm.get_config() rtmp_url = comm.iview_config['rtmp_url'] rtmp_host = comm.iview_config['rtmp_host'] rtmp_app = comm.iview_config['rtmp_app'] token = xml.find("token").string token = token.replace('&', '&') # work around BeautifulSoup bug return { 'rtmp_url' : rtmp_url, 'rtmp_host' : rtmp_host, 'rtmp_app' : rtmp_app, 'playpath_prefix' : playpath_prefix, 'token' : token, 'free' : (xml.find("free").string == "yes") }
def play(url): try: iview_config = comm.get_config() auth = comm.get_auth(iview_config) # We don't support Adobe HDS yet, Fallback to RTMP streaming server if auth['rtmp_url'].startswith('http://'): auth['rtmp_url'] = iview_config[ 'rtmp_url'] or config.akamai_fallback_server auth['playpath_prefix'] = config.akamai_playpath_prefix utils.log("Adobe HDS Not Supported, using fallback server %s" % auth['rtmp_url']) p = classes.Program() p.parse_xbmc_url(url) # Playpath shoud look like this: # Akamai: mp4:flash/playback/_definst_/itcrowd_10_03_02 playpath = auth['playpath_prefix'] + p.url if playpath.split('.')[-1] == 'mp4': playpath = 'mp4:' + playpath # Strip off the .flv or .mp4 playpath = playpath.split('.')[0] # rtmp://cp53909.edgefcs.net/ondemand?auth=daEbjbeaCbGcgb6bedYacdWcsdXc7cWbDda-bmt0Pk-8-slp_zFtpL&aifp=v001 # playpath=mp4:flash/playback/_definst_/kids/astroboy_10_01_22 swfurl=http://www.abc.net.au/iview/images/iview.jpg swfvfy=true rtmp_url = "%s?auth=%s playpath=%s swfurl=%s swfvfy=true" % ( auth['rtmp_url'], auth['token'], playpath, config.swf_url) listitem = xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.thumbnail, thumbnailImage=p.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()) xbmc.Player().play(rtmp_url, listitem) except: # oops print error message d = xbmcgui.Dialog() message = utils.dialog_error("Unable to play video") d.ok(*message) utils.log_error()
def play(url): try: iview_config = comm.get_config() auth = comm.get_auth(iview_config) # We don't support Adobe HDS yet, Fallback to RTMP streaming server if auth['rtmp_url'].startswith('http://'): auth['rtmp_url'] = iview_config['rtmp_url'] or config.akamai_fallback_server auth['playpath_prefix'] = config.akamai_playpath_prefix utils.log("Adobe HDS Not Supported, using fallback server %s" % auth['rtmp_url']) p = classes.Program() p.parse_xbmc_url(url) # Playpath shoud look like this: # Akamai: mp4:flash/playback/_definst_/itcrowd_10_03_02 playpath = auth['playpath_prefix'] + p.url if playpath.split('.')[-1] == 'mp4': playpath = 'mp4:' + playpath # Strip off the .flv or .mp4 playpath = playpath.split('.')[0] # rtmp://cp53909.edgefcs.net/ondemand?auth=daEbjbeaCbGcgb6bedYacdWcsdXc7cWbDda-bmt0Pk-8-slp_zFtpL&aifp=v001 # playpath=mp4:flash/playback/_definst_/kids/astroboy_10_01_22 swfurl=http://www.abc.net.au/iview/images/iview.jpg swfvfy=true rtmp_url = "%s?auth=%s playpath=%s swfurl=%s swfvfy=true" % (auth['rtmp_url'], auth['token'], playpath, config.swf_url) listitem=xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.thumbnail, thumbnailImage=p.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()) xbmc.Player().play(rtmp_url, listitem) except: # oops print error message d = xbmcgui.Dialog() message = utils.dialog_error("Unable to play video") 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 fill_media_list(series_list): iview_config = comm.get_config() ok = True # enumerate through the list of categories and add the item to the media list for s in series_list: url = "%s?series_id=%s" % (sys.argv[0], s.id) if s.get_image() and len(s.get_image()) > 0: icon = s.get_image() else: icon = __settings__.get_path('resources/images/abc.png') listitem = xbmcgui.ListItem(s.get_title(), iconImage=icon, thumbnailImage=icon) listitem.setProperty('fanart_image', icon) listitem.setInfo('video', {'episode':s.get_num_episodes(), 'plot': s.get_plot(), 'genre': s.get_keywords()}) # add the item to the media list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True, totalItems=len(series_list)) # if user cancels, call raise to exit loop if (not ok): raise xbmcplugin.setContent(handle=int(sys.argv[1]), content='tvshows') return ok
def get_programs(series_id): iview_config = comm.get_config() return comm.get_series_items(iview_config, series_id)
def get_categories(): iview_config = comm.get_config() categories = comm.get_categories(iview_config) return categories
def get_series(keyword): iview_config = comm.get_config() programme = comm.get_programme(iview_config, keyword) return programme
def get_keyword(keyword): iview_config = comm.get_config() keyword = comm.get_keyword_items(iview_config, keyword) return keyword
def get_categories(): iview_config = comm.get_config() categories = comm.get_categories(iview_config) return categories
def get_series(keyword): iview_config = comm.get_config() programme = comm.get_programme(iview_config, keyword) return programme
def get_programs(series_id): iview_config = comm.get_config() return comm.get_series_items(iview_config, series_id)
def get_series_list(category): iview_config = comm.get_config() return comm.get_category_series(iview_config, category)
def get_series(): iview_config = comm.get_config() programme = comm.get_programme(iview_config) return programme