Esempio n. 1
0
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())
Esempio n. 2
0
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())
Esempio n. 3
0
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)
Esempio n. 4
0
def execIrcPlugin(channel):
    if PLUGIN.get_setting('irc_enable', unicode) != 'true':
        return
    uname = PLUGIN.get_setting('irc_username', unicode)
    passwd = getOauthToken(token_only=False)
    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)
Esempio n. 5
0
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
Esempio n. 6
0
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
Esempio n. 7
0
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)
Esempio n. 8
0
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)
Esempio n. 9
0
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)
Esempio n. 10
0
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
Esempio n. 11
0
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
Esempio n. 12
0
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)
Esempio n. 13
0
def getMediaType():
    chosenType = PLUGIN.get_setting('contenttypes', unicode)
    mediaTypes = {
        '0': 'video',
        '1': 'tvshow',
        '2': 'movie',
        '3': 'episode',
        '4': 'musicvideo'
    }
    return mediaTypes.get(chosenType, 'video')
Esempio n. 14
0
def getContentType():
    chosenType = PLUGIN.get_setting('contenttypes', unicode)
    contentTypes = {
        '0': 'files',
        '1': 'tvshows',
        '2': 'movies',
        '3': 'episodes',
        '4': 'musicvideos'
    }
    return contentTypes.get(chosenType, 'files')
Esempio n. 15
0
def getUserName():
    username = PLUGIN.get_setting('username', unicode).lower()
    if not username:
        PLUGIN.open_settings()
        username = PLUGIN.get_setting('username', unicode).lower()
    return username
Esempio n. 16
0
def notifyRefresh():
    notify = True
    if PLUGIN.get_setting('notify_refresh', unicode) == 'false':
        notify = False
    return notify
Esempio n. 17
0
def getOauthToken():
    oauthtoken = PLUGIN.get_setting('oauth_token', unicode)
    if not oauthtoken:
        PLUGIN.open_settings()
        oauthtoken = PLUGIN.get_setting('oauth_token', unicode)
    return oauthtoken
Esempio n. 18
0
def getMediaType():
    chosenType = PLUGIN.get_setting('contenttypes', unicode)
    mediaTypes = {'0': 'video', '1': 'tvshow', '2': 'movie', '3': 'episode', '4': 'musicvideo'}
    return mediaTypes.get(chosenType, 'video')
Esempio n. 19
0
def getContentType():
    chosenType = PLUGIN.get_setting('contenttypes', unicode)
    contentTypes = {'0': 'files', '1': 'tvshows', '2': 'movies', '3': 'episodes', '4': 'musicvideos'}
    return contentTypes.get(chosenType, 'files')
Esempio n. 20
0
def getUserName():
    username = PLUGIN.get_setting('username', unicode).lower()
    if not username:
        PLUGIN.open_settings()
        username = PLUGIN.get_setting('username', unicode).lower()
    return username
Esempio n. 21
0
def notifyRefresh():
    notify = True
    if PLUGIN.get_setting('notify_refresh', unicode) == 'false':
        notify = False
    return notify
Esempio n. 22
0
def getOauthToken():
    oauthtoken = PLUGIN.get_setting('oauth_token', unicode)
    if not oauthtoken:
        PLUGIN.open_settings()
        oauthtoken = PLUGIN.get_setting('oauth_token', unicode)
    return oauthtoken