Exemplo n.º 1
0
def jouer_video(media_uid):
    """ function docstring """
    check_for_internet_connection()

    # Obtenir JSON avec liens RTMP du playlistService
    video_json = simplejson.loads(\
        cache.get_cached_content(\
            'http://production.ps.delve.cust.lldns.net/r/PlaylistService/media/%s/getPlaylistByMediaId' % media_uid\
        )\
    )

    play_list_item = video_json['playlistItems'][0]

    # Obtient les streams dans un playlist m3u8
    m3u8_pl = cache.get_cached_content(
        'https://mnmedias.api.telequebec.tv/m3u8/%s.m3u8' %
        play_list_item['refId'])

    # Cherche le stream de meilleure qualité
    uri = obtenirMeilleurStream(m3u8_pl)

    # lance le stream
    if uri:
        item = xbmcgui.ListItem(\
            video_json['title'],\
            iconImage=video_json['imageUrl'],\
            thumbnailImage=play_list_item['thumbnailImageUrl'], path=uri)
        play_item = xbmcgui.ListItem(path=uri)
        xbmcplugin.setResolvedUrl(__handle__, True, item)
    else:
        xbmc.executebuiltin('Notification(%s,Incapable d'
                            'obtenir lien du video,5000,%s')
Exemplo n.º 2
0
def jouer_video(url, media_uid):

    if "live" in url:
        jouer_live()
    else:
        """ function docstring """
        ref = re.split('/', url)
        refID = ref[len(ref) - 1]

        video_json = simplejson.loads(
            cache.get_cached_content(
                'https://mnmedias.api.telequebec.tv/api/v4/player/%s' % refID))
        thumbnail_url = content.getImage(video_json['imageUrlTemplate'], '320',
                                         '180')

        uri = getURI(video_json, refID)
        if uri:
            item = xbmcgui.ListItem(\
                video_json['title'],\
                iconImage=thumbnail_url,\
                thumbnailImage=thumbnail_url, path=uri)
            play_item = xbmcgui.ListItem(path=uri)
            xbmcplugin.setResolvedUrl(__handle__, True, item)
        else:
            xbmc.executebuiltin(
                'Notification(Aucun lien disponible,Incapable d\'obtenir le lien du vidéo,5000)'
            )
Exemplo n.º 3
0
def LoadContainerItems(filtres):
    log("content.LoadContainerItems")
    log(filtres)

    strURL = BASE_URL + "/page/" + filtres['content'][
        'url'] + "?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en"
    log("Accessing: " + strURL)
    jsonData = json.loads(cache.get_cached_content(strURL), encoding='utf-8')
    log("Returned:")
    log(jsonData)

    jsonContainers = jsonData['container']

    # Get the item ids for the selected container
    for jsonContainer in jsonContainers:
        if urllib2.unquote(u(
                jsonContainer['id'])) == filtres['content']['containerId']:
            jsonItemsInContainer = jsonContainer['itemId']

    jsonItems = jsonData['item']

    listItems = []
    for jsonItem in jsonItems:
        if jsonItem['id'] in jsonItemsInContainer:
            log(jsonItem['attributes'])
            dict = {}
            for s in jsonItem['attributes']:
                dict[s['key']] = s['value']

            listItems = listItems + AddItemToList(jsonItem, dict, filtres)

    log("content.LoadContainerItemsExit")
    return listItems
Exemplo n.º 4
0
def getDescription(url):
    #log(url)

    #thread = Thread(target = threaded_function, args = (10, ))
    #thread.start()
    #thread.join()

    #thread.start_new_thread(MyThread1, (url, ))

    #print "next...exiting"

    return "NULL"
    try:

        log("---url---")
        log(url)
        data = cache.get_cached_content(correctEmissionPageURL(url), True)

        log("---data----")
        #log(data)

        soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
        p = soup.findAll("div", {"class": "banner-card__body"})

        log(p)

        if len(p) > 0:
            desc = u(p[0].getText())
            log(desc)
            return desc
    except:
        log("Erreur de getDescription")
    return "Aucune information."
Exemplo n.º 5
0
def getJsonBlock(url, block):
    try:
        dataBlock = simplejson.loads(cache.get_cached_content(url))
        dataBlock = dataBlock['data'][block]['items']
    except ValueError:
        dataBlock = []
    finally:
        return dataBlock
Exemplo n.º 6
0
def getJsonBlock(url, block):
    try:
        dataBlock = simplejson.loads(cache.get_cached_content(url))
        dataBlock = dataBlock['data'][block]['items']
    except ValueError:
        dataBlock = []
    finally:
        return dataBlock
Exemplo n.º 7
0
def getJsonBlock(url, block):
    dataBlock = []
    try:
        db = simplejson.loads(cache.get_cached_content(url))
        dataBlock = db['data'][block]['items']
    except Exception:
        dataBlock = []
    return dataBlock
def chargerProchainePage(url):
    #log(url)
    data = cache.get_cached_content(url)
    soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    avecPagingation = soup.find("nav", {'class': re.compile('pagination-more.*')})
    if avecPagingation:
        data = data + chargerProchainePage(avecPagingation.find('a')['data-ajax-action'])
    
    return data
def jouer_video(source_url):
    """ function docstring """
    check_for_internet_connection()
    uri = None

    log("--media_uid--")
    log(source_url)

    data = simplejson.loads(
        cache.get_cached_content(THEPLATFORM_CONTENT_URL + source_url))

    log("--DATA PLATFORM--")
    log(data)

    url = ""

    for x in data['sources']:
        #log(x)
        #log(x['ext_x_version'])
        if x['ext_x_version'] == "5":
            url = x['src']
            break

    ## Obtenir JSON avec liens RTMP du playlistService
    #video_json = simplejson.loads(\
    #    cache.get_cached_content(\
    #        'http://production.ps.delve.cust.lldns.net/r/PlaylistService/media/%s/getPlaylistByMediaId' % media_uid\
    #    )\
    #)
    #
    #play_list_item =video_json['playlistItems'][0]
    #
    ## Obtient les streams dans un playlist m3u8
    #m3u8_pl=cache.get_cached_content('https://mnmedias.api.telequebec.tv/m3u8/%s.m3u8' % play_list_item['refId'])
    #
    ## Cherche le stream de meilleure qualité
    #uri = obtenirMeilleurStream(m3u8_pl)

    #soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    #video = soup.find("video", { "id" : "videoPlayer" })

    #log("video")
    #log(video)

    uri = url

    # lance le stream
    if uri:
        #item = xbmcgui.ListItem(\
        #    "Titre",\
        #    iconImage=None,\
        #    thumbnailImage=None, path=uri)
        play_item = xbmcgui.ListItem(path=uri)
        xbmcplugin.setResolvedUrl(__handle__, True, play_item)
    else:
        xbmc.executebuiltin('Notification(%s,Incapable d'
                            'obtenir lien du video,5000,%s')
Exemplo n.º 10
0
def liveStreamURL():
    config = getBrightcoveConfig()
    header = {
        'key': 'Accept',
        'value': 'application/json;pk=%s' % config['key']
    }
    a = cache.get_cached_content(
        'https://bcovlive-a.akamaihd.net/86e93a0ab79047e1b216e2b0a1ac5363/us-east-1/6150020952001/playlist.m3u8',
        True, [header])
    return 'https://bcovlive-a.akamaihd.net/86e93a0ab79047e1b216e2b0a1ac5363/us-east-1/6150020952001/' + obtenirMeilleurStream(
        a, 'profile')
Exemplo n.º 11
0
def jouer_video(media_uid):
    """ function docstring """
    check_for_internet_connection()

    # Obtenir JSON avec liens RTMP du playlistService
    video_json = simplejson.loads(
        cache.get_cached_content(
            "http://production.ps.delve.cust.lldns.net/r/PlaylistService/media/%s/getPlaylistByMediaId" % media_uid
        )
    )

    # Preparer list de videos à jouer
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playlist.clear()

    # Analyser chaque stream disponible pour trouver la meilleure qualité
    # for play_list_item in video_json['playlistItems']:
    play_list_item = video_json["playlistItems"][0]

    highest_bit_rate = 0
    stream_url = None
    for stream in play_list_item["streams"]:
        if stream["videoBitRate"] > highest_bit_rate:
            highest_bit_rate = stream["videoBitRate"]
            stream_url = stream["url"]
    if stream_url:
        # Générer un lien compatible pour librtmp
        # rtmp_url - play_path - swf_url
        url_final = "%s playPath=%s swfUrl=%s swfVfy=true" % (
            stream_url[: stream_url.find("mp4")],
            stream_url[stream_url.find("mp4") :],
            "http://s.delvenetworks.com/deployments/flash-player/flash-player-5.10.1.swf?playerForm=Chromeless",
        )
        # log('Starting playback of :' + urllib.quote_plus(url_final))
        item = xbmcgui.ListItem(
            video_json["title"],
            iconImage=video_json["imageUrl"],
            thumbnailImage=play_list_item["thumbnailImageUrl"],
            path=url_final,
        )
        # playlist.add(url_final, item)
        play_item = xbmcgui.ListItem(path=url_final)
        xbmc.log("**************************************DING? " + sys.argv[0])
        xbmcplugin.setResolvedUrl(__handle__, True, item)
        xbmc.log("**************************************DONG! ")
    else:
        xbmc.executebuiltin("Notification(%s,Incapable d" "obtenir lien du video,5000,%s" % (ADDON_NAME, ADDON_ICON))
Exemplo n.º 12
0
def getBrightcoveConfig():
    # hardcoded, in case...
    answer = {}
    answer[
        'key'] = 'BCpkADawqM3lBz07fdV6Q__Z8jM6RenArMfaM8YoxyIBexztP2lLBvXw2PlknyXbnK_1MMSmXw7qKqOM9mPI-doKvmqeywTJ3wKVzhdJSQN8JthhhmrUT5zVikMU8OvQEGirR-e7e7iqmZSC'
    answer['ad'] = 'dcd6de5f-a864-4ef6-b416-dcdc4f4af216'
    try:
        data = cache.get_cached_content(
            'https://players.brightcove.net/6150020952001/default_default/config.json',
            True)
        jsonData = simplejson.loads(data)
        answer['key'] = jsonData['video_cloud']['policy_key']
        answer['ad'] = jsonData['ad_config_id']

    except Exception:
        log('ERREUR, impossible de récupérer dynamiquement la configuration de Brightcove.'
            )

    return answer
Exemplo n.º 13
0
def loadEmission(filtres):
    log("loadEmission")
    log(filtres)

    liste = []

    #data = cache.get_cached_content(BASE_URL + filtres['content']['url'])

    data = json.loads(cache.get_cached_content(
        BASE_URL + "/page/" + filtres['content']['url'] +
        "?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en"),
                      encoding='utf-8')

    log("---data----")
    log(data)

    i = 1

    #soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)

    #avecPagingation = soup.find("nav", {'class': re.compile('pagination-more.*')})

    sections = data['item']

    #print "-----------------------------------------------"
    #print sections

    for section in sections:
        log(section['attributes'])
        dict = {}
        for s in section['attributes']:
            #print s['key']
            dict[s['key']] = s['value']

        #print "DICT"
        #print dict

        liste = liste + AjouterSectionAListe(section, dict, filtres)

    #print len(dict)

    return liste
Exemplo n.º 14
0
def m3u8BC(sourceId):
    config = getBrightcoveConfig()
    log('KEY : %s' % config['key'])
    log('Ad_Config_ID : %s' % config['ad'])
    header = {
        'key': 'Accept',
        'value': 'application/json;pk=%s' % config['key']
    }
    a = simplejson.loads(
        cache.get_cached_content(
            'https://edge.api.brightcove.com/playback/v1/accounts/6150020952001/videos/%s?ad_config_id=%s'
            % (sourceId, config['ad']), True, [header]))
    last = None
    for source in a['sources']:
        protocol = "dash+xml"
        https = "https"
        #protocol = "x-mpegURL"
        if protocol in source['type']:
            if https in source['vmap']:
                last = source['src']
    return last
Exemplo n.º 15
0
def jouer_video(url,media_uid):
    """ function docstring """
    check_for_internet_connection()
    ref = re.split('/',url)
    refID = ref[len(ref)-1]

    # Obtenir JSON avec liens RTMP du playlistService
    video_json = simplejson.loads(cache.get_cached_content('http://production.ps.delve.cust.lldns.net/r/PlaylistService/media/%s/getPlaylistByMediaId' % media_uid))
    m3u8_pl=m3u8(refID)

    # Cherche le stream de meilleure qualité
    uri = obtenirMeilleurStream(m3u8_pl)   

    # lance le stream
    if uri:
        item = xbmcgui.ListItem(\
            video_json['title'],\
            iconImage=video_json['imageUrl'],\
            thumbnailImage=video_json['imageUrl'], path=uri)
        play_item = xbmcgui.ListItem(path=uri)
        xbmcplugin.setResolvedUrl(__handle__,True, item)
    else:
        xbmc.executebuiltin('Notification(Aucun lien disponible,Incapable d''obtenir lien du vidéo,5000)')
Exemplo n.º 16
0
def LoadItems(filtres):
    log("content.LoadItems")
    log(filtres)

    strURL = BASE_URL + "/page/" + filtres['content'][
        'url'] + "?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en"
    log("Accessing: " + strURL)
    jsonData = json.loads(cache.get_cached_content(strURL), encoding='utf-8')
    log("Returned:")
    log(jsonData)

    jsonSections = jsonData['item']

    listItems = []
    for jsonSection in jsonSections:
        log(jsonSection['attributes'])
        dict = {}
        for s in jsonSection['attributes']:
            dict[s['key']] = s['value']

        listItems = listItems + AddItemToList(jsonSection, dict, filtres)

    log("content.LoadItemsExit")
    return listItems
Exemplo n.º 17
0
def MyThread1(arg):
    global num_threads
    num_threads += 1
    print "arg" + str(arg)
    cache.get_cached_content(correctEmissionPageURL(arg))
    num_threads -= 1
Exemplo n.º 18
0
def getLinkPop(url):
    database = simplejson.loads(
        cache.get_cached_content(POPULAIRE_URL + str(url)))
    return database['data'][0]
Exemplo n.º 19
0
def getShow(mediaBundleId):
    database = simplejson.loads(
        cache.get_cached_content(MEDIA_BUNDLE_URL + str(mediaBundleId)))
    return database['data']
Exemplo n.º 20
0
def LoadMainMenu(filtres):
    log("content.LoadMainMenu")

    strURL = BASE_URL + "/configurations?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en"
    log("Accessing: " + strURL)
    jsonConfig = json.loads(cache.get_cached_content(strURL, False),
                            encoding='utf-8')
    log("Returned:")
    log(jsonConfig)

    # ID of the start page
    strStartPage = jsonConfig['startPage']
    log("startPage: " + strStartPage)

    strPolicyKey = jsonConfig['policyKey']
    xbmcaddon.Addon().setSetting('policyKey', strPolicyKey)
    log("policyKey: " + strPolicyKey)

    jsonMenuItems = jsonConfig['menu']['menuItems']

    liste = []

    for carte in jsonMenuItems:
        if 'pageId' in carte:
            log(u(carte['title']) + ":")
            log(carte)

            newItem = {
                'genreId': 1,
                'title': urllib2.unquote(u(carte['title'])),
                'plot': ".",
                'image': xbmcaddon.Addon().getAddonInfo('path') + '/icon.png',
                'url': u(carte['pageId']),
                'filtres': GetCopy(filtres)
            }

            newItem['filtres']['content']['url'] = carte['pageId']
            newItem['isDir'] = True
            newItem['sortable'] = True
            newItem['fanart'] = xbmcaddon.Addon().getAddonInfo(
                'path') + '/fanart.jpg'
            newItem['filtres']['content']['genreId'] = newItem['genreId']

            # Check the different page aliases for the sections.
            if u(carte['pageAlias']) == "rattrapage" or \
               u(carte['pageAlias']) == "touslescontenus" or \
               u(carte['pageAlias']) == "direct" or \
               u(carte['pageAlias']) == "thematiques":
                liste.append(newItem)
            # Usefull for debugging, useless otherwise
            #else :
            #    newItem['title'] = newItem['title'] + " - NON FUNCTIONNAL"
            #    liste.append(newItem)

    # Add start page container
    strStartPageUrl = jsonConfig['startPage']

    newContainer = {
        'genreId': 1,
        'title': "Accueil",
        'filtres': GetCopy(filtres)
    }

    newContainer['image'] = xbmcaddon.Addon().getAddonInfo(
        'path') + '/icon.png'
    newContainer['fanart'] = xbmcaddon.Addon().getAddonInfo(
        'path') + '/fanart.jpg'

    newContainer['url'] = strStartPageUrl
    newContainer['plot'] = "."

    newContainer['filtres']['content']['url'] = newContainer['url']
    newContainer['filtres']['content']['genreId'] = newContainer['genreId']

    newContainer['isDir'] = True
    newContainer['sortable'] = True

    liste.append(newContainer)

    log("content.LoadMainMenuExit")
    return liste
Exemplo n.º 21
0
def LoadContainers(filtres):
    log("content.LoadContainers")
    log(filtres)

    strURL = BASE_URL + "/page/" + filtres['content'][
        'url'] + "?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en"
    log("Accessing: " + strURL)
    jsonData = json.loads(cache.get_cached_content(strURL), encoding='utf-8')
    log("Returned:")
    log(jsonData)

    jsonItems = jsonData['item']
    jsonContainers = jsonData['container']

    if 'containerId' in filtres['content']:
        log('Current container ID:')
        log(filtres['content']['containerId'])

    listContainers = []
    for jsonContainer in jsonContainers:

        # Array of container attributes
        aContAttributes = {}
        log(jsonContainer['attributes'])
        for s in jsonContainer['attributes']:
            aContAttributes[s['key']] = s['value']

        # Get container title
        strContainerTitle = ""
        if 'title' in aContAttributes:
            strContainerTitle = urllib2.unquote(u(aContAttributes['title']))

        listItems = []

        # List the items in the container
        if 'itemId' in jsonContainer:
            jsonItemsInContainer = jsonContainer['itemId']

            listItems = []
            for jsonItem in jsonItems:
                if jsonItem['id'] in jsonItemsInContainer:
                    aItemAttributes = {}
                    for s in jsonItem['attributes']:
                        aItemAttributes[s['key']] = s['value']

                    listItems = listItems + AddItemToList(
                        jsonItem, aItemAttributes, filtres)

        # No inner items, skip container
        if len(listItems) == 0:
            continue

        # Container has no title, add inner items
        elif strContainerTitle == "":
            listContainers = listContainers + listItems

        # Container title is a single character, add inner items.
        # This is to directly show alphabetically contained items.
        elif len(strContainerTitle) == 1:
            listContainers = listContainers + listItems

        # Only one container, add inner items
        elif len(jsonContainers) == 1:
            listContainers = listContainers + listItems

        # Show the container
        else:
            newContainer = {
                'genreId': 1,
                'title': strContainerTitle,
                'filtres': GetCopy(filtres)
            }

            newContainer['image'] = xbmcaddon.Addon().getAddonInfo(
                'path') + '/icon.png'
            newContainer['fanart'] = xbmcaddon.Addon().getAddonInfo(
                'path') + '/fanart.jpg'

            newContainer['url'] = newContainer['filtres']['content']['url']
            newContainer['containerId'] = urllib2.unquote(
                u(jsonContainer['id']))
            newContainer['plot'] = "."

            newContainer['filtres']['content']['containerId'] = newContainer[
                'containerId']
            newContainer['filtres']['content']['genreId'] = newContainer[
                'genreId']

            newContainer['isDir'] = True
            newContainer['sortable'] = True

            listContainers.append(newContainer)

    log("content.LoadContainersExit")
    return listContainers
Exemplo n.º 22
0
def getShow(mediaBundleId):
    database = simplejson.loads(cache.get_cached_content(MEDIA_BUNDLE_URL + str(mediaBundleId)))
    return database['data']
Exemplo n.º 23
0
def dictOfGenres(filtres):

    log("dictOfGenres")

    liste = []
    log("contenu")
    contenu = cache.get_cached_content(
        BASE_URL +
        "/configurations?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en",
        False)
    log(contenu)
    config = json.loads(contenu, encoding='utf-8')

    #elems = ET.fromstring(data)

    #startpage = elems.findtext( "startPage" )
    #log(startpage)
    #cat_scrapers = elems.find( "scrapers" ).findall( "entry" )

    #soup = BeautifulStoneSoup(config, convertEntities=BeautifulStoneSoup.XML_ENTITIES)

    log(config)

    #id de la page de démarrage
    startPage = config['startPage']
    log(startPage)

    policyKey = config['policyKey']
    xbmcaddon.Addon().setSetting('policyKey', policyKey)
    log(policyKey)

    accueil = json.loads(cache.get_cached_content(
        BASE_URL + "/page/" + startPage +
        "?uuid=5a0f10e5f31d1a2&gid=&appId=5955fc5423eec60006c951ef&locale=en"),
                         encoding='utf-8')
    #soup_data = BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.XML_ENTITIES)

    log("---accueil----")
    log(accueil)

    containers = accueil['container']
    menu = config['menu']['menuItems']

    #menu = soup.findAll('menuitems')
    #log(menu)

    #cartes = soup.findAll("div", { "class" : "card" })
    #cartes = soup.findAll("div", {'class': re.compile(r'\card\b')})

    i = 1

    for carte in menu:

        log("u(carte['title'])")
        log(carte)
        log(u(carte['title']))
        #pageid

        if 'pageId' in carte:
            #log(carte.findAll("img")[0]['src'])
            #log("------------------------------")
            newItem = {
                'genreId': i,
                'nom': u(carte['title']),
                'resume': ".",  #getDescription(carte.findAll("a")[0]['href']),
                'image': None,  #BASE_URL + carte.findAll("img")[0]['src'],
                'url': u(carte['pageId']),
                'filtres': parse.getCopy(filtres)
            }

            newItem['filtres']['content']['url'] = carte['pageId']

            if u(carte['title']) == "Rattrapage" or u(
                    carte['title']) == "Thématiques":
                liste.append(newItem)
            else:
                newItem['nom'] = newItem['nom'] + " - NON FONCTIONNEL"
                liste.append(newItem)

    #for carte in containers :
    #
    #    if 'title' in carte:
    #        log("carte['title']")
    #
    #        log(u(carte['title']))
    #        #pageid
    #
    #
    #        #log(carte.findAll("img")[0]['src'])
    #        #log("------------------------------")
    #        newItem = {   'genreId': i,
    #                      'nom': u(carte['title']),
    #                      'resume': ".", #getDescription(carte.findAll("a")[0]['href']),
    #                      'image' : None, #BASE_URL + carte.findAll("img")[0]['src'],
    #                      'url' : "self",
    #                      'filtres' : parse.getCopy(filtres)
    #                  }
    #
    #        newItem['filtres']['content']['url'] = "self"
    #
    #        liste.append(newItem)

    for item in liste:
        item['isDir'] = True
        item['forceSort'] = False
        item['nom'] = urllib2.unquote(item['nom'])
        #item['url'] = item['url'] or None
        item['image'] = item['image'] or xbmcaddon.Addon().getAddonInfo(
            'path') + '/icon.png'
        item['fanart'] = xbmcaddon.Addon().getAddonInfo('path') + '/fanart.jpg'
        #item['filtres'] = parse.getCopy(filtres)
        item['filtres']['content']['genreId'] = item['genreId']

    #log(liste)

    #while num_threads > 0:
    #    pass

    return liste
Exemplo n.º 24
0
def loadListeSaison(filtres):
    liste = []

    data = cache.get_cached_content(filtres['content']['url'])
    soup = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    clip = soup.findAll(
        "div", {'class': re.compile('clip-equalizer')})  #|clip-equalizer
    equalizer = soup.find(
        "div", {'class': re.compile('video-equalizer')})  #|clip-equalizer
    cartes = None
    if equalizer:
        cartes = equalizer.findAll("div", {"class": "card__thumb"})

    saisons = soup.findAll("a", {'href': re.compile('.*/saisons/.*')})

    log(saisons)

    cover = xbmcaddon.Addon().getAddonInfo('path') + '/fanart.jpg'
    if soup:
        coverdiv = soup.find("div", {'class': re.compile('banner__cover')})
        if coverdiv:
            cover = BASE_URL + coverdiv.find("img")['src']
    filtres['content']['cover'] = cover

    plot = ""
    if cartes:
        plot = ""
    else:
        plot = " (vide)"

    for saison in saisons:
        newItem = {
            'genreId': 2,
            'nom': u(saison.getText() + plot),
            'resume': "Voir les épisodes de la " + u(saison.getText()),
            'image': "DefaultFolder.png",
            'url': saison['href'],
            'filtres': parse.getCopy(filtres)
        }

        newItem['filtres']['content']['url'] = correctEmissionPageURL(
            saison['href'])
        newItem['filtres']['content']['cover'] = cover

        liste.append(newItem)

        #newItem = {   'genreId': i,
        #              'nom': "Capsules",
        #              'resume': "",
        #              'image' : None,
        #              'url' : "",
        #              'sourceUrl' : "",
        #              'filtres' : parse.getCopy(filtres)
        #          }
        #
        #liste.append(newItem)

    for item in liste:
        item['isDir'] = True
        item['forceSort'] = False
        item['nom'] = urllib2.unquote(item['nom'])
        #item['url'] = item['url'] or None
        item['image'] = item['image'] or xbmcaddon.Addon().getAddonInfo(
            'path') + '/icon.png'
        item['fanart'] = filtres['content'][
            'cover']  #cover #xbmcaddon.Addon().getAddonInfo('path')+'/fanart.jpg'
        #item['filtres'] = parse.getCopy(filtres)
        item['filtres']['content']['genreId'] = item['genreId']
        #item['filtres']['content']['cover'] = cover

    if clip:
        for c in clip:
            cartes = c.findAll("div", {"class": "card__thumb"})
            log("--cartes--")
            #log(cartes)

            liste = liste + listerEqualiser(cartes, filtres)
    #else:
    #    newItem = {   'genreId': i,
    #                  'nom': "Aucun contenu",
    #                  'resume': "Désolé",
    #                  'image' : None,
    #                  'url' : "",
    #                  'sourceUrl' : "",
    #                  'filtres' : parse.getCopy(filtres)
    #              }
    #
    #    liste.append(newItem)
    return liste
Exemplo n.º 25
0
def m3u8(refID):
    return cache.get_cached_content('https://mnmedias.api.telequebec.tv/m3u8/%s.m3u8' % refID,False)