def videos(params): url = urllib.unquote_plus(params['url']) page = '' if 'page' in params: page = '&page=' + params['page'] data = tv3.getJSON(url + page) listVideos(data)
def videoListFromUrl(params): url = urllib.unquote_plus(params['url']) data = tv3.getJSON(url) try: data = data['_embedded']['items'] except: return for item in data: if item['_meta']['type'] == 'video': addVideo(item) elif item['_meta']['type'] == 'format': addFolder(item) xbmcplugin.setContent(int( sys.argv[1] ), 'tvshows') xbmc.executebuiltin('Container.SetViewMode(503)') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def playVideo(params): title = urllib.unquote_plus(params['title']) url = urllib.unquote_plus(params['url']) img = urllib.unquote_plus(params['img']) data = tv3.getJSON(url) streamURL = '' streams = data['streams'] if streams['hls']: streamURL = streams['hls'] elif streams['high']: streamURL = streams['high'] elif streams['medium']: streamURL = streams['medium'] listitem = xbmcgui.ListItem(label = title) listitem.setPath(streamURL) listitem.setThumbnailImage(img) xbmcplugin.setResolvedUrl(handle = int(sys.argv[1]), succeeded = True, listitem = listitem)