def seasonCount(imdb, refresh=True, wait=False): try: if not imdb: return None if not imdb.startswith('tt'): return None indicators = cache.cache_existing(_seasonCountRetrieve, imdb) # get existing result while thread fetches new if refresh: thread = threading.Thread(target=_seasonCountCache, args=(imdb,)) thread.start() if wait: # NB: Do not wait to retrieve a fresh count, otherwise loading show/season menus are slow. thread.join() indicators = cache.cache_existing(_seasonCountRetrieve, imdb) return indicators except: log_utils.error() return None
def seasonCount(imdb, refresh=True, wait=False): try: if not imdb: return None if not imdb.startswith('tt'): imdb = 'tt' + imdb indicators = cache.cache_existing(_seasonCountRetrieve, imdb) if refresh: # NB: Do not retrieve a fresh count, otherwise loading show/season menus are slow. thread = threading.Thread(target=_seasonCountCache, args=(imdb, )) thread.start() if wait: thread.join() indicators = cache.cache_existing(_seasonCountRetrieve, imdb) return indicators except: return None
def seasonCount(imdb, refresh=True, wait=False): try: if not imdb: return None if not imdb.startswith('tt'): return None indicators = cache.cache_existing(_seasonCountRetrieve, imdb) # log_utils.log('indicators = %s' % indicators, log_utils.LOGDEBUG) if indicators: return indicators # added 9/2/20 if refresh: # NB: Do not retrieve a fresh count, otherwise loading show/season menus are slow. thread = threading.Thread(target=_seasonCountCache, args=(imdb,)) thread.start() if wait: thread.join() indicators = cache.cache_existing(_seasonCountRetrieve, imdb) return indicators except: log_utils.error() return None