mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 11:32:20 -05:00
Improved code for searching existing shows to find there indexerID and Indexer that they belong to for speed and accuracy
This commit is contained in:
parent
872389d055
commit
b8048a7e57
@ -322,19 +322,18 @@ def searchIndexersForShow(regShowName, indexer_id=None):
|
|||||||
search = [search]
|
search = [search]
|
||||||
|
|
||||||
# add search results
|
# add search results
|
||||||
result = [[t.config['id'], x['id']] for x in search if name.lower() == x['seriesname'].lower()]
|
for i in range(len(search)):
|
||||||
if len(result) > 0:
|
part = search[i]
|
||||||
result = [item for sublist in result for item in sublist]
|
seriesname = part['seriesname'].encode('UTF-8').lower()
|
||||||
return result
|
name = name.encode('UTF-8').lower()
|
||||||
|
|
||||||
|
if (seriesname == name) or (indexer_id is not None and part['id'] == indexer_id):
|
||||||
|
return [t.config['id'], part['id']]
|
||||||
|
|
||||||
except KeyError, e:
|
except KeyError, e:
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.log(
|
|
||||||
u"Error while auto-detecting show indexer and indexerid on indexer " + sickbeard.indexerApi(
|
|
||||||
indexer).name + ", retrying: " + ex(e), logger.ERROR)
|
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# search indexers for shows
|
# search indexers for shows
|
||||||
|
Loading…
Reference in New Issue
Block a user