示例#1
0
def list_last_edition(plugin, item_id, guid, **kwargs):
    json_url = 'products/get_product/%s' % guid
    json_r = urlquick.get(URL_API(json_url),
                          params={'token_application': TOKEN_APP},
                          headers={'User-agent': web_utils.get_ua()})
    json_v = json.loads(json_r.text)
    try:
        json_list = json_v['result']['list']
    except Exception:
        yield False

    for json_video in json_list:
        item = Listitem()
        item.label = json_video['title']
        if 'subtitle' in json_video:
            item.label = item.label + ' — ' + json_video['subtitle']

        if 'intro':
            item.info['plot'] = json_video['intro'].replace('<p>', '').replace(
                '</p>', '')
        youtube_id = json_video['main_video'][0]['youtube_id']

        try:
            for json_image in json_video['images']['formats']:
                item.art['fanart'] = json_image['url']
                item.art['thumb'] = item.art['landscape'] = json_image['url']
        except Exception:
            pass

        item.set_callback(get_video_url,
                          item_id=item_id,
                          youtube_id=youtube_id)
        item_post_treatment(item, is_playable=True, is_downloadable=True)
        yield item
示例#2
0
def list_videos(plugin, item_id, guid, page=1, **kwargs):
    json_url = 'products/get_product/%s' % guid
    json_r = urlquick.get(URL_API(json_url),
                          params={
                              'token_application': TOKEN_APP,
                              'page': page
                          },
                          headers={'User-agent': web_utils.get_ua()})
    json_v = json.loads(json_r.text)
    try:
        json_list = json_v['result']['list']
    except Exception:
        yield False

    for json_video in json_list:
        item = Listitem()
        item.label = json_video['title']
        youtube_id = json_video['youtube_id']

        try:
            for json_image in json_video['images']['formats']:
                item.art['fanart'] = json_image['url']
                item.art['thumb'] = item.art['landscape'] = json_image['url']
        except Exception:
            pass

        item.set_callback(get_video_url,
                          item_id=item_id,
                          youtube_id=youtube_id)
        item_post_treatment(item, is_playable=True, is_downloadable=True)
        yield item

    last_page = json_v['result']['last_page']
    if page != last_page:
        yield Listitem.next_page(item_id=item_id, guid=guid, page=page + 1)
示例#3
0
def list_direct_tv_jts(plugin, item_id, guid, **kwargs):
    json_url = 'products/get_product/%s' % guid
    json_r = urlquick.get(URL_API(json_url),
                          params={'token_application': TOKEN_APP},
                          headers={'User-agent': web_utils.get_ua()})
    json_v = json.loads(json_r.text)
    try:
        json_channels = json_v['result']['channels']
    except Exception:
        yield False

    for json_channel in json_channels:
        code = json_channel['code']
        if code == 'direct_f24':
            continue
        if code == 'live_audio':
            continue
        label = json_channel['title']
        '''

        for json_image in json_channel['images']['formats']:
            if json_image['code'] == '1920x1080':
                item.art['fanart'] = json_image['url']
            if json_image['code'] == '720x405':
                item.art['thumb'] = item.art['landscape'] = json_image['url'
        '''

        youtube_playlist_id = ''
        for json_video in json_channel['videos']:
            for json_format in json_video['formats']:
                if 'youtube_playlist_id' in json_format:
                    youtube_playlist_id = json_format['youtube_playlist_id']

        # print youtube_playlist_id
        yield Listitem.youtube(youtube_playlist_id, label=label)
示例#4
0
def live_entry(plugin, item_id, item_dict):
    root_json_url = 'products/get_product/78dcf358-9333-4fb2-a035-7b91e9705b13'
    root_json_r = urlquick.get(URL_API(root_json_url),
                               params={'token_application': TOKEN_APP})
    json_root = json.loads(root_json_r.text)

    try:
        json_languages = json_root['result']['list']['languages']
    except Exception:
        return False

    # code in JSON: FR, EN, ES and AR
    for json_language in json_languages:
        if json_language['code'] == LANG:
            json_tv = json_language['tv']
            if 'direct_tv' in json_tv:
                guid = json_tv['direct_tv']['guid']
                json_url = 'products/get_product/%s' % guid
                json_r = urlquick.get(
                    URL_API(json_url),
                    params={'token_application': TOKEN_APP},
                    headers={'User-agent': web_utils.get_ua()})
                json_v = json.loads(json_r.text)
                try:
                    json_channels = json_v['result']['channels']
                except Exception:
                    return False

                for json_channel in json_channels:
                    if json_channel['code'] == 'direct_f24':
                        for json_video in json_channel['videos']:
                            for json_format in json_video['formats']:
                                if json_format['code'] == 'hls_android':
                                    return json_format['url']
    return False
示例#5
0
def list_program_video(plugin, item_id, nid, guid_program, page=1):
    json_url = 'products/get_product/%s' % guid_program
    json_r = urlquick.get(URL_API(json_url),
                          params={
                              'token_application': TOKEN_APP,
                              'nid': nid,
                              'page': page
                          },
                          headers={'User-agent': web_utils.get_ua()})
    json_v = json.loads(json_r.text)

    try:
        json_list = json_v['result']['list']
    except Exception:
        yield False

    for json_video in json_list:
        item = Listitem()
        item.label = json_video['title']
        if 'subtitle' in json_video:
            item.label = item.label + ' — ' + json_video['subtitle']

        if 'intro':
            item.info['plot'] = json_video['intro'].replace('<p>', '').replace(
                '</p>', '')
        youtube_id = json_video['main_video'][0]['youtube_id']

        try:
            for json_image in json_video['images']['formats']:
                item.art['fanart'] = json_image['url']
                item.art['thumb'] = json_image['url']
        except Exception:
            pass

        item.context.script(get_video_url,
                            plugin.localize(LABELS['Download']),
                            item_id=item_id,
                            youtube_id=youtube_id,
                            video_label=LABELS[item_id] + ' - ' + item.label,
                            download_mode=True)

        item.set_callback(get_video_url,
                          item_id=item_id,
                          youtube_id=youtube_id)
        yield item

    last_page = json_v['result']['last_page']
    if page != last_page:
        yield Listitem.next_page(item_id=item_id,
                                 nid=nid,
                                 guid_program=guid_program,
                                 page=page + 1)
def live_entry(plugin, item_id, item_dict, **kwargs):

    final_language = LANG

    # If we come from the M3U file and the language
    # is set in the M3U URL, then we overwrite
    # Catch Up TV & More language setting
    if type(item_dict) is not dict:
        item_dict = eval(item_dict)
    if 'language' in item_dict:
        final_language = item_dict['language']

    root_json_url = 'products/get_product/78dcf358-9333-4fb2-a035-7b91e9705b13'
    root_json_r = urlquick.get(URL_API(root_json_url),
                               params={'token_application': TOKEN_APP})
    json_root = json.loads(root_json_r.text)

    try:
        json_languages = json_root['result']['list']['languages']
    except Exception:
        return False

    # code in JSON: FR, EN, ES and AR
    for json_language in json_languages:
        if json_language['code'] == final_language:
            json_tv = json_language['tv']
            if 'direct_tv' in json_tv:
                guid = json_tv['direct_tv']['guid']
                json_url = 'products/get_product/%s' % guid
                json_r = urlquick.get(
                    URL_API(json_url),
                    params={'token_application': TOKEN_APP},
                    headers={'User-agent': web_utils.get_ua()})
                json_v = json.loads(json_r.text)
                try:
                    json_channels = json_v['result']['channels']
                except Exception:
                    return False

                for json_channel in json_channels:
                    if json_channel['code'] == 'direct_f24':
                        for json_video in json_channel['videos']:
                            for json_format in json_video['formats']:
                                if json_format['code'] == 'hls_web':
                                    return json_format['url']
    return False
示例#7
0
def list_all_programs(plugin, item_id, guid, guid_program, page=1, **kwargs):
    json_url = 'products/get_product/%s' % guid
    json_r = urlquick.get(URL_API(json_url),
                          params={'token_application': TOKEN_APP},
                          headers={'User-agent': web_utils.get_ua()})
    json_v = json.loads(json_r.text)
    try:
        json_list = json_v['result']['list']
    except Exception:
        yield False

    for json_video in json_list:
        item = Listitem()
        item.label = json_video['title']
        if 'subtitle' in json_video:
            item.label = item.label + ' — ' + json_video['subtitle']

        if 'intro':
            item.info['plot'] = json_video['intro'].replace('<p>', '').replace(
                '</p>', '')

        try:
            for json_image in json_video['images']['formats']:
                item.art['fanart'] = json_image['url']
                item.art['thumb'] = item.art['landscape'] = json_image['url']
        except Exception:
            pass

        nid = json_video['nid']

        item.set_callback(list_program_video,
                          item_id=item_id,
                          nid=nid,
                          guid_program=guid_program)
        item_post_treatment(item)
        yield item

    last_page = json_v['result']['last_page']
    if page != last_page:
        yield Listitem.next_page(item_id=item_id, guid=guid, page=page + 1)