コード例 #1
0
def channelVideos(name):
    items = [{'label': PLUGIN.get_string(30078), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, past='true')},
             {'label': PLUGIN.get_string(30079), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, past='false')}]
    PLUGIN.set_content(utils.getContentType())
    return items
コード例 #2
0
def channelVideos(name):
    items = [{
        'label':
        PLUGIN.get_string(30078),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       past='true')
    }, {
        'label':
        PLUGIN.get_string(30079),
        'icon':
        Images.ICON,
        'thumbnail':
        Images.THUMB,
        'art':
        utils.theArt(),
        'path':
        PLUGIN.url_for(endpoint='channelVideosList',
                       name=name,
                       index=0,
                       past='false')
    }]
    PLUGIN.set_content(utils.getContentType())
    return items
コード例 #3
0
ファイル: routes.py プロジェクト: kyroskoh/Twitch-on-Kodi
def channelVideos(name):
    items = [{'label': PLUGIN.get_string(30078), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, broadcast_type='archive')},
             {'label': PLUGIN.get_string(30113), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, broadcast_type='upload')},
             {'label': PLUGIN.get_string(30079), 'icon': Images.ICON, 'thumbnail': Images.THUMB, 'art': utils.theArt(),
              'path': PLUGIN.url_for(endpoint='channelVideosList', name=name, index=0, broadcast_type='highlight')}]
    PLUGIN.set_content(utils.getContentType())
    return items
コード例 #4
0
def handleTwitchException(exception):
    codeTranslations = {TwitchException.NO_STREAM_URL: 30023,
                        TwitchException.STREAM_OFFLINE: 30021,
                        TwitchException.HTTP_ERROR: 30020,
                        TwitchException.JSON_ERROR: 30027,
                        TwitchException.NO_PLAYABLE: 30080}
    code = exception.code
    title = 30010
    msg = codeTranslations[code]
    PLUGIN.notify(PLUGIN.get_string(title), PLUGIN.get_string(msg), image=Images.ICON)
コード例 #5
0
def handleTwitchException(exception):
    codeTranslations = {
        TwitchException.NO_STREAM_URL: 30023,
        TwitchException.STREAM_OFFLINE: 30021,
        TwitchException.HTTP_ERROR: 30020,
        TwitchException.JSON_ERROR: 30027,
        TwitchException.NO_PLAYABLE: 30080
    }
    code = exception.code
    title = 30010
    msg = codeTranslations[code]
    PLUGIN.notify(PLUGIN.get_string(title),
                  PLUGIN.get_string(msg),
                  image=Images.ICON)
コード例 #6
0
def search():
    query = PLUGIN.keyboard('', PLUGIN.get_string(30007))
    if query:
        target = PLUGIN.url_for(endpoint='searchresults', query=query, index='0')
    else:
        target = PLUGIN.url_for(endpoint='createMainListing')
    PLUGIN.redirect(target)
コード例 #7
0
ファイル: utils.py プロジェクト: Muus/Twitch.tv-on-XBMC
def contextClearPreviews():
    context_menu = []
    if PLUGIN.get_setting('live_previews_enable', unicode) == 'true':
        notify = str(notifyRefresh())
        context_menu.extend([(PLUGIN.get_string(30084), 'RunPlugin(%s)' %
                              PLUGIN.url_for(endpoint='clearLivePreviews', notify=notify))])
    return context_menu
コード例 #8
0
ファイル: routes.py プロジェクト: kyroskoh/Twitch-on-Kodi
def search():
    query = PLUGIN.keyboard('', PLUGIN.get_string(30007))
    if query:
        target = PLUGIN.url_for(endpoint='searchresults', query=query, index='0')
    else:
        target = PLUGIN.url_for(endpoint='createMainListing')
    PLUGIN.redirect(target)
コード例 #9
0
ファイル: utils.py プロジェクト: spoon3r/Twitch-on-Kodi
def contextClearPreviews():
    context_menu = []
    if PLUGIN.get_setting('live_previews_enable', unicode) == 'true':
        notify = str(notifyRefresh())
        context_menu.extend([(PLUGIN.get_string(30084), 'RunPlugin(%s)' %
                              PLUGIN.url_for(endpoint='clearLivePreviews', notify=notify))])
    return context_menu
コード例 #10
0
def createFollowingList():
    username = utils.getUserName()
    if not username:
        utils.notification(PLUGIN.get_string(30095))
    else:
        streams = TWITCHTV.getFollowingStreams(username)
        liveStreams = [CONVERTER.convertStreamToListItem(stream) for stream in streams[Keys.LIVE]]
        liveStreams.insert(0, {'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                               'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                               'label': PLUGIN.get_string(30012)})
        liveStreams.append({'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                            'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                            'label': PLUGIN.get_string(30013)})
        liveStreams.extend([CONVERTER.convertFollowersToListItem(follower) for follower in streams[Keys.OTHERS]])
        utils.refreshPreviews()
        PLUGIN.set_content(utils.getContentType())
        return liveStreams
コード例 #11
0
ファイル: routes.py プロジェクト: kyroskoh/Twitch-on-Kodi
def createFollowingList():
    username = utils.getUserName()
    if not username:
        utils.notification(PLUGIN.get_string(30095))
    else:
        streams = TWITCHTV.getFollowingStreams(username)
        liveStreams = [CONVERTER.convertStreamToListItem(stream) for stream in streams[Keys.LIVE]]
        liveStreams.insert(0, {'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                               'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                               'label': PLUGIN.get_string(30012)})
        liveStreams.append({'path': PLUGIN.url_for(endpoint='createFollowingList'), 'icon': Images.ICON,
                            'thumbnail': Images.THUMB, 'art': utils.theArt(), 'is_playable': False,
                            'label': PLUGIN.get_string(30013)})
        liveStreams.extend([CONVERTER.convertFollowersToListItem(follower) for follower in streams[Keys.OTHERS]])
        utils.refreshPreviews()
        PLUGIN.set_content(utils.getContentType())
        return liveStreams
コード例 #12
0
ファイル: utils.py プロジェクト: spoon3r/Twitch-on-Kodi
def linkToNextPage(target, currentIndex, **kwargs):
    return {
        'label': PLUGIN.get_string(30011),
        'icon': Images.ICON,
        'thumbnail': Images.THUMB,
        'art': theArt(),
        'path': PLUGIN.url_for(target, index=str(currentIndex + 1), **kwargs)
    }
コード例 #13
0
ファイル: routes.py プロジェクト: kyroskoh/Twitch-on-Kodi
def createFollowingGameList():
    username = utils.getUserName()
    if not username:
        utils.notification(PLUGIN.get_string(30095))
    else:
        games = TWITCHTV.getFollowingGames(username)
        items = [CONVERTER.convertGameToListItem(element) for element in games]
        PLUGIN.set_content(utils.getContentType())
        return items
コード例 #14
0
def createFollowingGameList():
    username = utils.getUserName()
    if not username:
        utils.notification(PLUGIN.get_string(30095))
    else:
        games = TWITCHTV.getFollowingGames(username)
        items = [CONVERTER.convertGameToListItem(element) for element in games]
        PLUGIN.set_content(utils.getContentType())
        return items
コード例 #15
0
ファイル: utils.py プロジェクト: Muus/Twitch.tv-on-XBMC
def getVideoQuality(quality=''):
    """
    :param quality: string int/int: qualities[quality]
    qualities
    0 = Best, 1 = 720, 2 = 480, 3 = 360, 4 = 226,
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    i18n: 0 = 30041, 1 = 30042, 2 = 30043, 3 = 30044, 4 = 30063
    """
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
    i18n_qualities = [PLUGIN.get_string(30041), PLUGIN.get_string(30042), PLUGIN.get_string(30043),
                      PLUGIN.get_string(30044), PLUGIN.get_string(30063)]
    try:
        quality = int(quality)
        if 4 >= quality >= 0:
            chosenQuality = str(quality)
        elif quality == -1:
            chosenQuality = str(xbmcgui.Dialog().select(PLUGIN.get_string(30077), i18n_qualities))
        else:
            raise ValueError
    except ValueError:
        chosenQuality = PLUGIN.get_setting('video', unicode)

    if chosenQuality == '-1':
        # chosenQuality == '-1' if dialog was cancelled
        return int(chosenQuality)
    else:
        return qualities.get(chosenQuality, sys.maxint)
コード例 #16
0
ファイル: utils.py プロジェクト: grocal/Twitch.tv-on-XBMC
def getVideoQuality(quality=''):
    """
    :param quality: string int/int: qualities[quality]
    qualities
    0 = Best, 1 = 720, 2 = 480, 3 = 360, 4 = 226,
    -1 = Choose quality dialog
    * any other value for quality will use addon setting
    i18n: 0 = 30041, 1 = 30042, 2 = 30043, 3 = 30044, 4 = 30063
    """
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4}
    i18n_qualities = [
        PLUGIN.get_string(30041),
        PLUGIN.get_string(30042),
        PLUGIN.get_string(30043),
        PLUGIN.get_string(30044),
        PLUGIN.get_string(30063)
    ]
    try:
        quality = int(quality)
        if 4 >= quality >= 0:
            chosenQuality = str(quality)
        elif quality == -1:
            chosenQuality = str(xbmcgui.Dialog().select(
                PLUGIN.get_string(30077), i18n_qualities))
        else:
            raise ValueError
    except ValueError:
        chosenQuality = PLUGIN.get_setting('video', unicode)

    if chosenQuality == '-1':
        # chosenQuality == '-1' if dialog was cancelled
        return int(chosenQuality)
    else:
        return qualities.get(chosenQuality, sys.maxint)
コード例 #17
0
ファイル: utils.py プロジェクト: spoon3r/Twitch-on-Kodi
def getVideoQuality(quality=''):
    """
    :param quality: string int/int: qualities[quality]
    qualities
    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
    i18n: 0 = 30102 ... 9 = 30111
    """
    qualities = {
        '-1': -1,
        '0': 0,
        '1': 1,
        '2': 2,
        '3': 3,
        '4': 4,
        '5': 5,
        '6': 6,
        '7': 7,
        '8': 8,
        '9': 9
    }
    i18n_qualities = [
        PLUGIN.get_string(30102),
        PLUGIN.get_string(30103),
        PLUGIN.get_string(30104),
        PLUGIN.get_string(30105),
        PLUGIN.get_string(30106),
        PLUGIN.get_string(30107),
        PLUGIN.get_string(30108),
        PLUGIN.get_string(30109),
        PLUGIN.get_string(30110),
        PLUGIN.get_string(30111)
    ]
    try:
        quality = int(quality)
        if 9 >= quality >= 0:
            chosenQuality = str(quality)
        elif quality == -1:
            chosenQuality = str(xbmcgui.Dialog().select(
                PLUGIN.get_string(30077), i18n_qualities))
        else:
            raise ValueError
    except ValueError:
        chosenQuality = PLUGIN.get_setting('video', unicode)

    if chosenQuality == '-1':
        # chosenQuality == '-1' if dialog was cancelled
        return int(chosenQuality)
    else:
        return qualities.get(chosenQuality, sys.maxint)
コード例 #18
0
ファイル: utils.py プロジェクト: Muus/Twitch.tv-on-XBMC
def linkToNextPage(target, currentIndex, **kwargs):
    return {'label': PLUGIN.get_string(30011),
            'icon': Images.ICON,
            'thumbnail': Images.THUMB,
            'art': theArt(),
            'path': PLUGIN.url_for(target, index=str(currentIndex + 1), **kwargs)}
コード例 #19
0
ファイル: routes.py プロジェクト: kyroskoh/Twitch-on-Kodi
def createMainListing():
    context_menu = []
    context_menu.extend(utils.contextClearPreviews())
    items = [
        {'label': PLUGIN.get_string(30005),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfFeaturedStreams')
         },
        {'label': PLUGIN.get_string(30001),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfGames', index='0')
         },
        {'label': PLUGIN.get_string(30008),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfChannels', index='0')
         },
        {'label': PLUGIN.get_string(30002),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingList')
         },
        {'label': PLUGIN.get_string(30066),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingGameList')
         },
        {'label': PLUGIN.get_string(30006),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfTeams', index='0')
         },
        {'label': PLUGIN.get_string(30098),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListForSelectedVideo')
         },
        {'label': PLUGIN.get_string(30003),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='search')
         },
        {'label': PLUGIN.get_string(30004),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='showSettings')
         }
    ]
    PLUGIN.set_content(utils.getContentType())
    return items
コード例 #20
0
def createMainListing():
    context_menu = []
    context_menu.extend(utils.contextClearPreviews())
    items = [
        {'label': PLUGIN.get_string(30005),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfFeaturedStreams')
         },
        {'label': PLUGIN.get_string(30001),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfGames', index='0')
         },
        {'label': PLUGIN.get_string(30008),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfChannels', index='0')
         },
        {'label': PLUGIN.get_string(30002),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingList')
         },
        {'label': PLUGIN.get_string(30066),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createFollowingGameList')
         },
        {'label': PLUGIN.get_string(30006),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListOfTeams', index='0')
         },
        {'label': PLUGIN.get_string(30098),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='createListForSelectedVideo')
         },
        {'label': PLUGIN.get_string(30003),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='search')
         },
        {'label': PLUGIN.get_string(30004),
         'icon': Images.ICON,
         'thumbnail': Images.THUMB,
         'art': utils.theArt(),
         'context_menu': context_menu,
         'path': PLUGIN.url_for(endpoint='showSettings')
         }
    ]
    PLUGIN.set_content(utils.getContentType())
    return items
コード例 #21
0
ファイル: utils.py プロジェクト: beastd/Twitch.tv-on-XBMC
def getVideoQuality(quality=''):
    """
    :param quality: string int/int: qualities[quality]
    qualities
    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
    i18n: 0 = 30102 ... 9 = 30111
    """
    qualities = {'-1': -1, '0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9 }
    i18n_qualities = [PLUGIN.get_string(30102), PLUGIN.get_string(30103), PLUGIN.get_string(30104),
                      PLUGIN.get_string(30105), PLUGIN.get_string(30106), PLUGIN.get_string(30107),
                      PLUGIN.get_string(30108), PLUGIN.get_string(30109), PLUGIN.get_string(30110),
                      PLUGIN.get_string(30111)]
    try:
        quality = int(quality)
        if 9 >= quality >= 0:
            chosenQuality = str(quality)
        elif quality == -1:
            chosenQuality = str(xbmcgui.Dialog().select(PLUGIN.get_string(30077), i18n_qualities))
        else:
            raise ValueError
    except ValueError:
        chosenQuality = PLUGIN.get_setting('video', unicode)

    if chosenQuality == '-1':
        # chosenQuality == '-1' if dialog was cancelled
        return int(chosenQuality)
    else:
        return qualities.get(chosenQuality, sys.maxint)