Exemplo n.º 1
0
def cache_retry(config, logger):
    """
    Thread timer for the cache retry logic.

    :param config: config (ConfigParser obj)
    """

    retry = 3600
    logger.info('starting cache_retry thread.')
    user_name = config['lastfm']['user_name']
    password = config['lastfm']['password']
    api_key = config['lastfm']['api_key']
    api_secret = config['lastfm']['api_secret']
    cache_location = config['plex-scrobble']['cache_location']

    while True:
        try:
            cache = ScrobbleCache(api_key,
                                  api_secret,
                                  user_name,
                                  password,
                                  cache_location=cache_location)
        except Exception as e:
            logger.warning('ERROR: {0}, retrying in {1} seconds'.format(
                e, retry))
            time.sleep(retry)
            continue
        # do not retry if cache is empty.
        if cache.length() > 0:
            cache.retry_queue()

        time.sleep(retry)
Exemplo n.º 2
0
def cache_retry(config, logger):
    """
    Thread timer for the cache retry logic.

    :param config: config (ConfigParser obj)
    """

    retry = 3600
    logger.info('starting cache_retry thread.')
    user_name = config['lastfm']['user_name']
    password = config['lastfm']['password']
    api_key = config['lastfm']['api_key']
    api_secret = config['lastfm']['api_secret']
    cache_location = config['plex-scrobble']['cache_location']

    while True:
        try:
            cache = ScrobbleCache(api_key, api_secret, user_name, password,
                                  cache_location=cache_location)
        except Exception as e:
            logger.warning('ERROR: {0}, retrying in {1} seconds'.format(e, retry))
            time.sleep(retry)
            continue
        # do not retry if cache is empty.
        if cache.length() > 0:
            cache.retry_queue()

        time.sleep(retry)
Exemplo n.º 3
0
def cache_retry(config):
    """
    Thread timer for the cache retry logic.

    :param config: config (ConfigParser obj)
    """

    while True:
        logger.info('starting cache_retry thread.')
        cache = ScrobbleCache(config)
        # do not retry if cache is empty.
        if cache.length() > 0:
            cache.retry_queue()

        cache.close()
        time.sleep(3600)