Beispiel #1
0
def play(livestream=None, brightcoveId=None, channel=None, **kwargs):
    if brightcoveId:
        item = api.get_brightcove_src(brightcoveId)

    elif livestream:
        item = plugin.Item(path=livestream,
                           art=False,
                           inputstream=inputstream.HLS(live=True))

        if kwargs.get(ROUTE_LIVE_TAG) == ROUTE_LIVE_SUFFIX and not gui.yes_no(
                _.PLAY_FROM, yeslabel=_.PLAY_FROM_LIVE,
                nolabel=_.PLAY_FROM_START):
            item.properties['ResumeTime'] = '1'
            item.properties['TotalTime'] = '1'

            item.inputstream = inputstream.HLS(force=True, live=True)
            if not item.inputstream.check():
                plugin.exception(_.LIVE_HLS_REQUIRED)

    elif channel:
        data = api.channel(channel)
        item = plugin.Item(path=data['publisherMetadata']['liveStreamUrl'],
                           art=False,
                           inputstream=inputstream.HLS(live=True))

    item.headers = HEADERS

    return item
Beispiel #2
0
def _play_videos(videos):
    if not videos:
        plugin.exception('No videos found')

    default_audio = settings.getEnum('audio_lang', AUDIO_LANGS)

    if len(videos) == 1:
        chosen = videos[0]
    else:
        videos = sorted(videos, key=lambda x: x['language'])

        chosen = None
        for video in videos:
            if video['language']['iso_639_3'].lower() == default_audio:
                chosen = video
                break

        if not chosen:
            index = gui.select(_.SELECT_LANG,
                               [x['language']['name'] for x in videos])
            if index < 0:
                return

            chosen = videos[index]

    url, license_url = api.play(chosen['id'])
    item = plugin.Item(
        inputstream=inputstream.Widevine(license_url),
        path=url,
        headers=HEADERS,
        use_proxy=
        True,  # Needed for https://github.com/xbmc/inputstream.adaptive/pull/606
    )

    return item
Beispiel #3
0
def play(id, **kwargs):
    data = api.playback_auth(id)

    if 'errors' in data:
        msg = data['errors'][0]['message']
        plugin.exception(msg)

    referenceID = data['data']['playbackAuth']['videos'][0]['referenceId']
    jwt_token = data['data']['playbackAuth']['videos'][0]['token']

    item = api.get_brightcove_src(referenceID, jwt_token)
    item.headers = HEADERS

    return item
Beispiel #4
0
def play(callsign, **kwargs):
    app_data = _app_data()
    all_stations = app_data['channels']
    station = all_stations[callsign]

    if not station['url']:
        plugin.exception(_.NO_STREAM_MSG)

    item = plugin.Item(
        label=station['name'],
        path=station['url'],
        art={'thumb': station['logo']},
        headers=app_data['headers'],
        inputstream=inputstream.HLS(live=True),
    )

    return item
Beispiel #5
0
def play(callsign, **kwargs):
    all_stations = api.all_stations()
    station = all_stations[callsign]

    if not station['url']:
        plugin.exception(_.NO_STREAM_MSG)

    item = plugin.Item(
        label=station['name'],
        path=station['url'],
        art={'thumb': station['logo']},
        headers=HEADERS,
        inputstream=inputstream.HLS(live=True),
        geolock='US',
    )

    return item