當前位置: 首頁>>代碼示例>>Python>>正文


Python constants.PLUGIN類代碼示例

本文整理匯總了Python中constants.PLUGIN的典型用法代碼示例。如果您正苦於以下問題:Python PLUGIN類的具體用法?Python PLUGIN怎麽用?Python PLUGIN使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PLUGIN類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: contextClearPreviews

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
開發者ID:Muus,項目名稱:Twitch.tv-on-XBMC,代碼行數:7,代碼來源:utils.py

示例2: searchresults

def searchresults(query, index='0'):
    index, offset, limit = utils.calculatePaginationValues(index)
    streams = TWITCHTV.searchStreams(query, offset, limit)
    items = [CONVERTER.convertStreamToListItem(stream) for stream in streams]
    items.append(utils.linkToNextPage('searchresults', index, query=query))
    utils.refreshPreviews()
    PLUGIN.set_content(utils.getContentType())
    return items
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:8,代碼來源:routes.py

示例3: refreshPreviews

def refreshPreviews():
    if PLUGIN.get_setting('live_previews_enable', unicode) != 'true':
        return
    if PLUGIN.get_setting('refresh_previews', unicode) == 'true':
        refresh_interval = PLUGIN.get_setting('refresh_interval', int) * 60
        if getRefreshDiff() >= refresh_interval:
            setRefeshStamp()
            TextureCacheCleaner().remove_like(LIVE_PREVIEW_IMAGE, notifyRefresh())
開發者ID:Muus,項目名稱:Twitch.tv-on-XBMC,代碼行數:8,代碼來源:utils.py

示例4: createListOfTeams

def createListOfTeams(index):
    index = int(index)
    teams = TWITCHTV.getTeams(index)
    items = [CONVERTER.convertTeamToListItem(item) for item in teams]
    if len(teams) == 25:
        items.append(utils.linkToNextPage('createListOfTeams', index))
    PLUGIN.set_content(utils.getContentType())
    return items
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:8,代碼來源:routes.py

示例5: createListForGame

def createListForGame(gameName, index):
    index, offset, limit = utils.calculatePaginationValues(index)
    items = [CONVERTER.convertStreamToListItem(stream) for stream
             in TWITCHTV.getGameStreams(gameName, offset, limit)]

    items.append(utils.linkToNextPage('createListForGame', index, gameName=gameName))
    utils.refreshPreviews()
    PLUGIN.set_content(utils.getContentType())
    return items
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:9,代碼來源:routes.py

示例6: createFollowingGameList

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
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:9,代碼來源:routes.py

示例7: channelVideosList

def channelVideosList(name, index, past):
    index = int(index)
    offset = index * 8
    videos = TWITCHTV.getFollowerVideos(name, offset, past)
    items = [CONVERTER.convertVideoListToListItem(video) for video in videos[Keys.VIDEOS]]
    if videos[Keys.TOTAL] > (offset + 8):
        items.append(utils.linkToNextPage('channelVideosList', index, name=name, past=past))
    PLUGIN.set_content(utils.getContentType())
    return items
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:9,代碼來源:routes.py

示例8: execIrcPlugin

def execIrcPlugin(channel):
    if PLUGIN.get_setting('irc_enable', unicode) != 'true':
        return
    uname = PLUGIN.get_setting('irc_username', unicode)
    passwd = PLUGIN.get_setting('irc_password', unicode)
    host = 'irc.chat.twitch.tv'
    scrline = 'RunScript(script.ircchat, run_irc=True&nickname=%s&username=%s&password=%s&host=%s&channel=#%s)' % \
              (uname, uname, passwd, host, channel)
    xbmc.executebuiltin(scrline)
開發者ID:Muus,項目名稱:Twitch.tv-on-XBMC,代碼行數:9,代碼來源:utils.py

示例9: createListOfGames

def createListOfGames(index):
    index, offset, limit = utils.calculatePaginationValues(index)

    games = TWITCHTV.getGames(offset, limit)
    items = [CONVERTER.convertGameToListItem(element[Keys.GAME]) for element in games]

    items.append(utils.linkToNextPage('createListOfGames', index))
    PLUGIN.set_content(utils.getContentType())
    return items
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:9,代碼來源:routes.py

示例10: handleTwitchException

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)
開發者ID:Bruny07,項目名稱:Twitch.tv-on-XBMC,代碼行數:10,代碼來源:exception.py

示例11: play

def play(item, listItem):
    fromAddon = xbmc.getInfoLabel('Container.PluginName') == PLUGIN.id
    withPlayer = int(sys.argv[1]) == -1
    if withPlayer or not fromAddon:
        playbackItem = xbmcgui.ListItem(label=listItem.get('label', ''),
                                        thumbnailImage=listItem.get('thumbnail', Images.VIDEOTHUMB),
                                        path=listItem.get('path', item))
        playbackItem.setProperty('IsPlayable', 'true')
        xbmc.Player().play(item, playbackItem)
    else:
        PLUGIN.set_resolved_url(listItem)
開發者ID:Muus,項目名稱:Twitch.tv-on-XBMC,代碼行數:11,代碼來源:utils.py

示例12: getOauthToken

def getOauthToken(token_only=True):
    oauthtoken = PLUGIN.get_setting('oauth_token', unicode)
    if not oauthtoken:
        PLUGIN.open_settings()
        oauthtoken = PLUGIN.get_setting('oauth_token', unicode)
    if oauthtoken:
        if token_only:
            oauthtoken = oauthtoken.replace('oauth:', '')
        else:
            if not oauthtoken.lower().startswith('oauth:'):
                oauthtoken = 'oauth:{0}'.format(oauthtoken)
    return oauthtoken
開發者ID:beastd,項目名稱:Twitch.tv-on-XBMC,代碼行數:12,代碼來源:utils.py

示例13: channelVideos

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
開發者ID:beastd,項目名稱:Twitch.tv-on-XBMC,代碼行數:9,代碼來源:routes.py

示例14: getVideoQuality

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)
開發者ID:Muus,項目名稱:Twitch.tv-on-XBMC,代碼行數:28,代碼來源:utils.py

示例15: search

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)
開發者ID:spiffomatic64,項目名稱:Twitch.tv-on-XBMC,代碼行數:7,代碼來源:routes.py


注:本文中的constants.PLUGIN類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。