1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

If we fail to find season/episode info for air-by-date shows via DB query we attempt via indexerAPI calls

This commit is contained in:
echel0n 2014-08-09 11:14:51 +00:00
parent dfc18b8d54
commit 1ee64ced4d

View File

@ -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