From 75c7fbf137f32e2a3d12943baa436a0b5354fe6d Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 3 May 2014 03:36:57 -0700 Subject: [PATCH] Fixes issues in tvcache --- sickbeard/helpers.py | 4 +++- sickbeard/tvcache.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index aeed08a4..59dbb21c 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -973,7 +973,9 @@ def get_show_by_name(name): if indexerid: logger.log(u"Found Indexer ID:[" + repr(indexerid) + "], using that for [" + name + "}",logger.DEBUG) if not showObj: - showObj = [x for x in sickbeard.showList if x.indexerid == indexerid][0] + showObjList = [x for x in sickbeard.showList if x.indexerid == indexerid] + if len(showObjList): + showObj = showObjList[0] return showObj def is_hidden_folder(folder): diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index 1a75c75f..4bdcc06e 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -203,7 +203,8 @@ class TVCache(): logger.log(u"No series name retrieved from " + name + ", unable to cache it", logger.DEBUG) return None - if not helpers.get_show_by_name(parse_result.series_name): + showObj = helpers.get_show_by_name(parse_result.series_name) + if showObj: logger.log(u"Could not find a show matching " + parse_result.series_name + " in the database, skipping ...", logger.DEBUG) return None @@ -212,7 +213,7 @@ class TVCache(): airdate = parse_result.air_date.toordinal() sql_results = myDB.select("SELECT season, episode FROM tv_episodes WHERE showid = ? AND indexer = ? AND airdate = ?", - [parse_result.show.indexerid, parse_result.show.indexer, airdate]) + [showObj.indexerid, showObj.indexer, airdate]) if sql_results > 0: season = int(sql_results[0]["season"]) episodes = [int(sql_results[0]["episode"])]