From 1ee64ced4d57e8d0d8add6ce67ee28e80ff3595c Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 9 Aug 2014 11:14:51 +0000 Subject: [PATCH] If we fail to find season/episode info for air-by-date shows via DB query we attempt via indexerAPI calls --- sickbeard/name_parser/parser.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 95dc14c7..09f1f6da 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -255,6 +255,26 @@ class NameParser(object): if sql_result: season_number = int(sql_result[0][0]) episode_numbers = [int(sql_result[0][1])] + else: + try: + lINDEXER_API_PARMS = sickbeard.indexerApi(bestResult.show.indexer).api_params.copy() + + if bestResult.show.lang: + lINDEXER_API_PARMS['language'] = bestResult.show.lang + + t = sickbeard.indexerApi(bestResult.show.indexer).indexer(**lINDEXER_API_PARMS) + + if bestResult.is_air_by_date: + epObj = t[bestResult.show.indexerid].airedOn(parse_result.air_date)[0] + else: + epObj = t[bestResult.show.indexerid].airedOn(parse_result.sports_air_date)[0] + + season_number = int(epObj["seasonnumber"]) + episode_numbers = [int(epObj["episodenumber"])] + except sickbeard.indexer_episodenotfound: + logger.log(u"Unable to find episode with date " + str(parse_result.air_date) + " for show " + bestResult.show.name + ", skipping", logger.WARNING) + except sickbeard.indexer_error, e: + logger.log(u"Unable to contact " + sickbeard.indexerApi(bestResult.show.indexer).name + ": " + ex(e), logger.WARNING for epNo in episode_numbers: s = season_number