Ejemplo n.º 1
0
def playLive(name, quality):
    """
    :param name: string: stream/channel name
    :param quality: string: qualities[quality]
    0 = Source, 1 = 1080p60, 2 = 1080p30, 3 = 720p60, 4 = 720p30, 5 = 540p30, 6 = 480p30, 7 = 360p30, 8 = 240p30, 9 = 144p30
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    """
    videoQuality = utils.getVideoQuality(quality)
    if videoQuality != -1:
        # videoQuality == -1 if quality dialog was cancelled
        stream = CONVERTER.convertStreamToPlayItem(TWITCHTV.getStreamInfo(name))
        stream['path'] = TWITCHTV.getLiveStream(name, videoQuality)
        utils.play(stream['path'], stream)
        utils.execIrcPlugin(name)
Ejemplo n.º 2
0
def playLive(name, quality):
    """
    :param name: string: stream/channel name
    :param quality: string: qualities[quality]
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
    0 = Best, 1 = 720, 2 = 480, 3 = 360, 4 = 226,
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    """
    videoQuality = utils.getVideoQuality(quality)
    if videoQuality != -1:
        # videoQuality == -1 if quality dialog was cancelled
        stream = CONVERTER.convertStreamToPlayItem(TWITCHTV.getStreamInfo(name))
        stream['path'] = TWITCHTV.getLiveStream(name, videoQuality)
        utils.play(stream['path'], stream)
        utils.execIrcPlugin(name)
Ejemplo n.º 3
0
def playLive(name, quality):
    """
    :param name: string: stream/channel name
    :param quality: string: qualities[quality]
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
    0 = Best, 1 = 720, 2 = 480, 3 = 360, 4 = 226,
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    """
    videoQuality = utils.getVideoQuality(quality)
    if videoQuality != -1:
        # videoQuality == -1 if quality dialog was cancelled
        stream = CONVERTER.convertStreamToPlayItem(
            TWITCHTV.getStreamInfo(name))
        stream['path'] = TWITCHTV.getLiveStream(name, videoQuality)
        utils.play(stream['path'], stream)
        utils.execIrcPlugin(name)
Ejemplo n.º 4
0
def playVideo(_id, quality):
    """
    :param _id: string: video id
    :param quality: string: qualities[quality]
    0 = Source, 1 = 1080p60, 2 = 1080p30, 3 = 720p60, 4 = 720p30, 5 = 540p30, 6 = 480p30, 7 = 360p30, 8 = 240p30, 9 = 144p30
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    """
    videoQuality = utils.getVideoQuality(quality)
    oauthtoken = utils.getOauthToken()
    if videoQuality != -1:
        # videoQuality == -1 if quality dialog was cancelled
        videoInfo = CONVERTER.getVideoInfo(TWITCHTV.getVideo(_id))
        simplePlaylist = TWITCHTV.getVideoPlaylist(_id, videoQuality, oauthtoken)
        playlistItems = PLAYLIST_CONVERTER.convertToXBMCPlaylist(simplePlaylist, videoInfo.get('title', ''),
                                                                 videoInfo.get('thumbnail', ''))
        if playlistItems != ():
            (playlist, listItem) = playlistItems
            utils.play(listItem.get('path', ''), listItem)
        else:
            raise TwitchException(TwitchException.NO_PLAYABLE)
Ejemplo n.º 5
0
def playVideo(_id, quality):
    """
    :param _id: string: video id
    :param quality: string: qualities[quality]
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
    0 = Best, 1 = 720, 2 = 480, 3 = 360, 4 = 226,
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    """
    videoQuality = utils.getVideoQuality(quality)
    if videoQuality != -1:
        # videoQuality == -1 if quality dialog was cancelled
        videoInfo = CONVERTER.getVideoInfo(TWITCHTV.getVideo(_id))
        simplePlaylist = TWITCHTV.getVideoPlaylist(_id, videoQuality)
        playlistItems = PLAYLIST_CONVERTER.convertToXBMCPlaylist(simplePlaylist, videoInfo.get('title', ''),
                                                                 videoInfo.get('thumbnail', ''))
        if playlistItems != ():
            (playlist, listItem) = playlistItems
            utils.play(listItem.get('path', ''), listItem)
        else:
            raise TwitchException(TwitchException.NO_PLAYABLE)
Ejemplo n.º 6
0
def playVideo(_id, quality):
    """
    :param _id: string: video id
    :param quality: string: qualities[quality]
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
    0 = Best, 1 = 720, 2 = 480, 3 = 360, 4 = 226,
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    """
    videoQuality = utils.getVideoQuality(quality)
    if videoQuality != -1:
        # videoQuality == -1 if quality dialog was cancelled
        videoInfo = CONVERTER.getVideoInfo(TWITCHTV.getVideo(_id))
        simplePlaylist = TWITCHTV.getVideoPlaylist(_id, videoQuality)
        playlistItems = PLAYLIST_CONVERTER.convertToXBMCPlaylist(
            simplePlaylist, videoInfo.get('title', ''),
            videoInfo.get('thumbnail', ''))
        if playlistItems != ():
            (playlist, listItem) = playlistItems
            utils.play(listItem.get('path', ''), listItem)
        else:
            raise TwitchException(TwitchException.NO_PLAYABLE)