def getMixed(url, name): log('getMixed') xbmcplugin.setContent(int(sys.argv[1]), 'episodes') if name == LANGUAGE(40009): cookiesOAT2 = json.loads(getCookieOAT2())['cookiesOAT2'] items = json.loads(cacheURL(url, headers, cookiesOAT2, False)) else: items = json.loads(cacheURL(url, headers)) for item in items['contents']: typecontent = item['detaillink'].split('/')[4] if typecontent == "programme": addVideo(item) elif typecontent == "groupe" or typecontent == "magazine": addVideosGroup(item) elif typecontent == "serie": addSeasonsGroup(item) next = items['next'] if next: nexturl = API_BURL + next infoList = {"mediatype": "episode", "title": LANGUAGE(40012)} infoArt = { "thumb": ICON, "poster": ICON, "fanart": FANART, "icon": ICON, "logo": ICON } addDir(LANGUAGE(40012), nexturl, 8, infoArt, infoList)
def getTvShows(url): log('getTvShows') xbmcplugin.setContent(int(sys.argv[1]), 'episodes') headers = {'User-Agent': USER_AGENT} items = json.loads(cacheURL(url, headers)) for item in items['contents']: showId = item['detaillink'].rsplit('/', 1)[1] title = item['title'][0]['value'] thumb = IMAGE_BURL + item['imageurl'] fanart = thumb.split('?')[0] infoList = { "mediatype": "episode", "title": title, "TVShowTitle": title } infoArt = { "thumb": thumb, "poster": thumb, "fanart": fanart, "icon": ICON, "logo": ICON } addDir(title, showId, 3, infoArt, infoList, 0, showId) next = items['next'] if next: nexturl = API_BURL + next infoList = {"mediatype": "episode", "title": LANGUAGE(40012)} infoArt = { "thumb": ICON, "poster": ICON, "fanart": FANART, "icon": ICON, "logo": ICON } addDir(LANGUAGE(40012), nexturl, 2, infoArt, infoList)
def getSeasons(showId): log('getSeasons') xbmcplugin.setContent(int(sys.argv[1]), 'episodes') headers = {'User-Agent': USER_AGENT} items = json.loads(cacheURL(SHOW_API % showId, headers))['contents'] TVShowTitle = "" for item in items['seasons']: seasonID = item['id'] plot = item['pitch'] thumb = IMAGE_BURL + item['imageurl'] fanart = thumb.split('?')[0] seasonNum = item['number'] title = LANGUAGE(40013) + ' %s' % seasonNum infoList = { "mediatype": "episode", "title": title, "plot": plot, "TVShowTitle": title } infoArt = { "thumb": thumb, "poster": thumb, "fanart": fanart, "icon": ICON, "logo": ICON } infos = json.dumps({ "showId": showId, "seasonID": seasonID, 'seasonNum': seasonNum }) addDir(title, infos, 4, infoArt, infoList)
def loadSearch(items): for item in items['contents']: title = item['title'][0]['value'].lower().title() thumb = IMAGE_BURL + item['imageurl'] fanart = thumb.split('?')[0] runtime = item['duration'] duration = getDuration(runtime) typecontent = item['detaillink'].split('/')[4] if typecontent == 'programme': streamID = item['id'] infoLabels = { "mediatype": "episode", "title": title, "duration": duration, "TVShowTitle": title } infoArt = { "thumb": thumb, "poster": thumb, "fanart": fanart, "icon": ICON, "logo": ICON } addLink(title, streamID, 9, infoLabels, infoArt) elif typecontent == 'serie': showId = item['detaillink'].rsplit('/', 1)[1] infoList = { "mediatype": "episode", "title": title, "TVShowTitle": title } infoArt = { "thumb": thumb, "poster": thumb, "fanart": fanart, "icon": ICON, "logo": ICON } addDir(title, showId, 3, infoArt, infoList) next = items['next'] if next: nexturl = API_BURL + urllib.quote(items['next'], safe='/') infoList = {"mediatype": "episode", "title": "Next"} infoArt = { "thumb": ICON, "poster": ICON, "fanart": FANART, "icon": ICON, "logo": ICON } addDir("Next", nexturl, 6, infoArt, infoList)
def addSeasonsGroup(item): log('addSeasonsGroup') subtitle = item['subtitle'] title = item['title'][0]['value'].lower().title() + ' [%s]' % subtitle thumb = IMAGE_BURL + item['imageurl'] fanart = thumb.split('?')[0] showId = item['detaillink'].rsplit('/', 1)[1] infoList = {"mediatype": "episode", "title": title, "TVShowTitle": title} infoArt = { "thumb": thumb, "poster": thumb, "fanart": fanart, "icon": ICON, "logo": ICON } addDir(title, showId, 3, infoArt, infoList, 0, showId)
def getMovies(url): log('getMovies') xbmcplugin.setContent(int(sys.argv[1]), 'episodes') headers = {'User-Agent': USER_AGENT} items = json.loads(cacheURL(url, headers)) for item in items['contents']: movieID = item['id'] infos = json.loads(cacheURL(MOVIE_API % movieID, headers))['contents'] streamID = infos['playinfoid']['sd'] if streamID: title = item['title'][0]['value'].lower().title() thumb = IMAGE_BURL + item['imageurl'] fanart = thumb.split('?')[0] plot = title + ':\n' + infos['summary'] runtime = infos['duration'] duration = getDuration(runtime) infoLabels = { "mediatype": "movie", "title": title, "plot": plot, "TVShowTitle": title } infoArt = { "thumb": thumb, "poster": thumb, "fanart": fanart, "icon": ICON, "logo": ICON } addLink(title, streamID, 9, infoLabels, infoArt, len(items), movieID) next = items['next'] if next: nexturl = API_BURL + next infoList = {"mediatype": "episode", "title": LANGUAGE(40012)} infoArt = { "thumb": ICON, "poster": ICON, "fanart": FANART, "icon": ICON, "logo": ICON } addDir(LANGUAGE(40012), nexturl, 5, infoArt, infoList)
def buildMenu(self): try: items = json.loads(getCookieOAT2()) cookiesOAT2 = items['cookiesOAT2'] if items['ischild']: for item in KIDS_SUB_MENU: addDir(*item) else: for item in MAIN_MENU: addDir(*item) except: for item in MAIN_MENU: addDir(*item)
def browseSubMenu(self): for item in KIDS_SUB_MENU: addDir(*item)