def _retrieve_anidb_mainnames(): global MAX_ANIDB_AGE_SECS success = False anidb_mainNames = {} cacheDB = db.DBConnection('cache.db') rows = cacheDB.select("SELECT last_refreshed FROM scene_exceptions_refresh WHERE list = ?", ['anidb']) if rows: refresh = time.time() > (int(rows[0]['last_refreshed']) + MAX_ANIDB_AGE_SECS) else: refresh = True if refresh: for show in sickbeard.showList: if show.is_anime and show.indexer == 1: try: anime = adba.Anime(None, name=show.name, tvdbid=show.indexerid, autoCorrectName=True) except: continue else: success = True if anime.name and anime.name != show.name: anidb_mainNames[show.indexerid] = [{anime.name: -1}] if success: cacheDB.action("INSERT OR REPLACE INTO scene_exceptions_refresh (list, last_refreshed) VALUES (?,?)", ['anidb', time.time()]) return anidb_mainNames
def _retrieve_anidb_mainnames(): anidb_mainNames = {} for show in sickbeard.showList: if show.is_anime: try: anime = adba.Anime(None, name=show.name, tvdbid=show.tvdbid, autoCorrectName=True) except: continue else: if anime.name and anime.name != show.name: anidb_mainNames[show.tvdbid] = [{anime.name:-1}] logger.log("anidb anime names: " + str(anidb_mainNames), logger.DEBUG) return anidb_mainNames
def _anidb_exceptions_fetcher(): global anidb_exception_dict if shouldRefresh('anidb'): logger.log(u"Checking for scene exception updates for AniDB") for show in sickbeard.showList: if show.is_anime and show.indexer == 1: try: anime = adba.Anime(None, name=show.name, tvdbid=show.indexerid, autoCorrectName=True) except: continue else: if anime.name and anime.name != show.name: anidb_exception_dict[show.indexerid] = [{anime.name: -1}] setLastRefresh('anidb') return anidb_exception_dict