Example #1
0
def live(channel):
    token = channel_token(channel)

    q = UsherQuery('api/channel/hls/{channel}.m3u8')
    q.add_urlkw(keys.CHANNEL, channel)
    q.add_param(keys.SIG, token[keys.SIG])
    q.add_param(keys.TOKEN, token[keys.TOKEN])
    q.add_param(keys.ALLOW_SOURCE, Boolean.FALSE)
    return q
Example #2
0
def live(channel):
    token = channel_token(channel)

    q = UsherQuery("api/channel/hls/{channel}.m3u8")
    q.add_urlkw(keys.CHANNEL, channel)
    q.add_param(keys.SIG, token[keys.SIG])
    q.add_param(keys.TOKEN, token[keys.TOKEN])
    q.add_param(keys.ALLOW_SOURCE, Boolean.FALSE)
    return q
Example #3
0
def _vod(id):
    id = id[1:]

    token = vod_token(id)

    q = UsherQuery('vod/{id}')
    q.add_urlkw(keys.ID, id)
    q.add_param(keys.NAUTHSIG, token[keys.SIG])
    q.add_param(keys.NAUTH, token[keys.TOKEN])
    return q
Example #4
0
def _vod(id):
    id = id[1:]

    token = vod_token(id)

    q = UsherQuery("vod/{id}")
    q.add_urlkw(keys.ID, id)
    q.add_param(keys.NAUTHSIG, token[keys.SIG])
    q.add_param(keys.NAUTH, token[keys.TOKEN])
    return q
Example #5
0
def video_request(video_id):
    video_id = valid_video_id(video_id)
    if video_id:
        token = vod_token(video_id)
        if keys.ERROR in token:
            return token
        else:
            q = UsherQuery('vod/{id}')
            q.add_urlkw(keys.ID, video_id)
            q.add_param(keys.NAUTHSIG, token[keys.SIG])
            q.add_param(keys.NAUTH, token[keys.TOKEN])
            q.add_param(keys.ALLOW_SOURCE, Boolean.TRUE)
            q.add_param(keys.ALLOW_AUDIO_ONLY, Boolean.TRUE)
            url = '?'.join([q.url, urlencode(q.params)])
            request_dict = {'url': url, 'headers': q.headers}
            log.debug('video_request: |{0}|'.format(str(request_dict)))
            return request_dict
    else:
        raise NotImplementedError('Unknown Video Type')
Example #6
0
def _live(channel, token):
    q = UsherQuery('api/channel/hls/{channel}.m3u8')
    q.add_urlkw(keys.CHANNEL, channel)
    q.add_param(keys.SIG, token[keys.SIG])
    q.add_param(keys.TOKEN, token[keys.TOKEN])
    q.add_param(keys.ALLOW_SOURCE, Boolean.TRUE)
    q.add_param(keys.ALLOW_SPECTRE, Boolean.TRUE)
    q.add_param(keys.ALLOW_AUDIO_ONLY, Boolean.TRUE)
    return q
Example #7
0
def live_request(channel):
    token = channel_token(channel)
    if keys.ERROR in token:
        return token
    else:
        q = UsherQuery('api/channel/hls/{channel}.m3u8')
        q.add_urlkw(keys.CHANNEL, channel)
        q.add_param(keys.SIG, token[keys.SIG])
        q.add_param(keys.TOKEN, token[keys.TOKEN])
        q.add_param(keys.ALLOW_SOURCE, Boolean.TRUE)
        q.add_param(keys.ALLOW_SPECTRE, Boolean.TRUE)
        q.add_param(keys.ALLOW_AUDIO_ONLY, Boolean.TRUE)
        url = '?'.join([q.url, urlencode(q.params)])
        request_dict = {'url': url, 'headers': q.headers}
        log.debug('live_request: |{0}|'.format(str(request_dict)))
        return request_dict
Example #8
0
def _vod(video_id, token):
    q = UsherQuery('vod/{id}')
    q.add_urlkw(keys.ID, video_id)
    q.add_param(keys.NAUTHSIG, token[keys.SIG])
    q.add_param(keys.NAUTH, token[keys.TOKEN])
    q.add_param(keys.ALLOW_SOURCE, Boolean.TRUE)
    q.add_param(keys.ALLOW_AUDIO_ONLY, Boolean.TRUE)
    return q