예제 #1
0
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)
예제 #2
0
def addVideo(item):
    log('addVideo')
    url = API_BURL + item['detaillink']
    infos = json.loads(cacheURL(url, headers))['contents']
    streamID = infos['playinfoid']['sd']
    if streamID:
        plot = infos['summary']
        subtitle = item['subtitle'].title()
        title = item['title'][0]['value'].lower().title() + ' [%s]' % subtitle
        thumb = IMAGE_BURL + item['imageurl']
        fanart = thumb.split('?')[0]
        progID = infos['id']
        runtime = infos['duration']
        duration = getDuration(runtime)
        infoLabels = {
            "mediatype": "episode",
            "title": title,
            "plot": plot,
            "duration": duration,
            "TVShowTitle": title
        }
        infoArt = {
            "thumb": thumb,
            "poster": thumb,
            "fanart": fanart,
            "icon": ICON,
            "logo": ICON
        }
        addLink(title, streamID, 9, infoLabels, infoArt, 0, progID)
예제 #3
0
def getDocsMagsFavs(url):
    log('getDocsMagsFavs')
    xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
    headers = {'User-Agent': USER_AGENT}
    episodes = json.loads(cacheURL(url, headers))['contents']['episodes']
    for item in episodes:
        streamID = item['playinfoid'][
            'sd']  # ['acontents'][0]['contents'][0]['playinfoid']['sd']
        if streamID:
            title = item['title'][0]['value'].title() + ':\n'
            plot = title + ':\n' + item['summary']
            thumb = IMAGE_BURL + item['imageurl']
            fanart = thumb.split('?')[0]
            runtime = item['duration']
            duration = getDuration(runtime)
            infoLabels = {
                "mediatype": "episode",
                "title": title,
                "plot": plot,
                "duration": duration,
                "TVShowTitle": title
            }
            infoArt = {
                "thumb": thumb,
                "poster": thumb,
                "fanart": fanart,
                "icon": ICON,
                "logo": ICON
            }
            addLink(title, streamID, 9, infoLabels, infoArt, len(episodes))
예제 #4
0
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)
예제 #5
0
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)
예제 #6
0
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)
예제 #7
0
def searchKidsContent(url=None):
    xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
    if not url:
        search_string = xbmcgui.Dialog().input('Search',
                                               type=xbmcgui.INPUT_ALPHANUM)
        url = SEARCH_KIDS_API % urllib.quote('title=' + search_string)
    headers = {"User-Agent": USER_AGENT}
    items = json.loads(cacheURL(url, headers))
    try:
        loadSearch(items)
    except:
        xbmcgui.Dialog().notification(ADDON_NAME, LANGUAGE(40014), ICON, 4000)
예제 #8
0
def getEpisodes(infos):
    log('getEpisodes')
    xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
    items = json.loads(infos)
    showId = items['showId']
    seasonID = items['seasonID']
    seasonNum = items['seasonNum']
    headers = {'User-Agent': USER_AGENT}
    showjson = json.loads(cacheURL(SHOW_API % showId, headers))['contents']
    showTitle = showjson['title'][0]['value']
    seasons = showjson['seasons']
    for season in seasons:
        if season['id'] != seasonID: continue
        for item in season['episodes']:
            streamID = item['playinfoid'][
                'sd']  # ['acontents'][0]['contents'][0]['playinfoid']['sd']
            if streamID:
                title = item['title'][0]['value'].title() + ':\n'
                plot = title + ':\n' + item['summary']
                thumb = IMAGE_BURL + item['imageurl']
                fanart = thumb.split('?')[0]
                episodeNum = item['number']
                seinfo = ('S' + ('0' if seasonNum < 10 else '') +
                          str(seasonNum) + 'E' +
                          ('0' if episodeNum < 10 else '') + str(episodeNum))
                runtime = item['duration']
                duration = getDuration(runtime)
                infoLabels = {
                    "mediatype": "episode",
                    "title": showTitle + ' ' + seinfo,
                    "plot": plot,
                    "duration": duration,
                    "TVShowTitle": title
                }
                infoArt = {
                    "thumb": thumb,
                    "poster": thumb,
                    "fanart": fanart,
                    "icon": ICON,
                    "logo": ICON
                }
                addLink(title, streamID, 9, infoLabels, infoArt, len(items))