mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-18 07:15:13 -05:00
Fix for issues relating to adding existing shows and nothing happens.
This commit is contained in:
parent
071d51fcda
commit
20bc92650b
@ -283,7 +283,7 @@ def makeDir(path):
|
|||||||
|
|
||||||
|
|
||||||
def searchDBForShow(regShowName):
|
def searchDBForShow(regShowName):
|
||||||
showNames = list(set([re.sub('[. -]', ' ', regShowName), regShowName]))
|
showNames = list({re.sub('[. -]', ' ', regShowName), regShowName})
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
|
|
||||||
@ -309,36 +309,40 @@ def searchDBForShow(regShowName):
|
|||||||
return (int(sqlResults[0]["indexer"]), int(sqlResults[0]["indexer_id"]), sqlResults[0]["show_name"])
|
return (int(sqlResults[0]["indexer"]), int(sqlResults[0]["indexer_id"]), sqlResults[0]["show_name"])
|
||||||
|
|
||||||
def searchIndexerForShowID(regShowName, indexer=None, indexer_id=None, ui=None):
|
def searchIndexerForShowID(regShowName, indexer=None, indexer_id=None, ui=None):
|
||||||
showNames = list(set([re.sub('[. -]', ' ', regShowName), regShowName]))
|
showNames = list({re.sub('[. -]', ' ', regShowName), regShowName})
|
||||||
|
|
||||||
# Query Indexers for each search term and build the list of results
|
# Query Indexers for each search term and build the list of results
|
||||||
for indexer in sickbeard.indexerApi().indexers if not indexer else [int(indexer)]:
|
for i in sickbeard.indexerApi().indexers if not indexer else int(indexer or []):
|
||||||
# Query Indexers for each search term and build the list of results
|
# Query Indexers for each search term and build the list of results
|
||||||
lINDEXER_API_PARMS = sickbeard.indexerApi(indexer).api_params.copy()
|
lINDEXER_API_PARMS = sickbeard.indexerApi(i).api_params.copy()
|
||||||
if ui: lINDEXER_API_PARMS['custom_ui'] = ui
|
if ui is not None: lINDEXER_API_PARMS['custom_ui'] = ui
|
||||||
t = sickbeard.indexerApi(indexer).indexer(**lINDEXER_API_PARMS)
|
t = sickbeard.indexerApi(i).indexer(**lINDEXER_API_PARMS)
|
||||||
|
|
||||||
for name in showNames:
|
for name in showNames:
|
||||||
logger.log(u"Trying to find " + name + " on " + sickbeard.indexerApi(indexer).name, logger.DEBUG)
|
logger.log(u"Trying to find " + name + " on " + sickbeard.indexerApi(i).name, logger.DEBUG)
|
||||||
try:
|
|
||||||
search = t[indexer_id] if indexer_id else t[name]
|
search = t[indexer_id] if indexer_id else t[name]
|
||||||
|
try:
|
||||||
|
seriesname = search.seriesname
|
||||||
|
except:
|
||||||
|
seriesname = None
|
||||||
|
try:
|
||||||
|
series_id = search.id
|
||||||
|
except:
|
||||||
|
series_id = None
|
||||||
|
|
||||||
# add search results
|
if not (seriesname and series_id):
|
||||||
for i in range(len(search)):
|
continue
|
||||||
part = search[i]
|
|
||||||
seriesname = part['seriesname'].lower()
|
|
||||||
|
|
||||||
if str(name).lower() == seriesname or (indexer_id and part['id'] == indexer_id):
|
if str(name).lower() == str(seriesname).lower and not indexer_id:
|
||||||
return [sickbeard.indexerApi(indexer).config['id'], part['id']]
|
return (seriesname, int(sickbeard.indexerApi(i).config['id']), int(series_id))
|
||||||
|
elif int(indexer_id) == int(series_id):
|
||||||
|
return (seriesname, int(sickbeard.indexerApi(i).config['id']), int(indexer_id))
|
||||||
|
|
||||||
except KeyError:
|
|
||||||
if indexer:
|
if indexer:
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
continue
|
|
||||||
except Exception:
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
return (None, None, None)
|
||||||
|
|
||||||
def sizeof_fmt(num):
|
def sizeof_fmt(num):
|
||||||
'''
|
'''
|
||||||
|
@ -2072,19 +2072,15 @@ class NewHomeAddShows:
|
|||||||
if show_name: break
|
if show_name: break
|
||||||
|
|
||||||
# default to TVDB if indexer was not detected
|
# default to TVDB if indexer was not detected
|
||||||
if show_name and (indexer is None or indexer_id is None):
|
if show_name and not (indexer and indexer_id):
|
||||||
for idx in sickbeard.indexerApi().indexers:
|
(sn,idx,id) = helpers.searchIndexerForShowID(show_name, indexer, indexer_id)
|
||||||
found_info = helpers.searchIndexerForShowID(show_name, idx, indexer_id, ui=classes.ShowListUI)
|
|
||||||
if found_info:
|
|
||||||
# set indexer and indexer_id from found info
|
# set indexer and indexer_id from found info
|
||||||
if indexer is None:
|
if indexer is None and idx:
|
||||||
indexer = found_info[0]
|
indexer = idx
|
||||||
|
|
||||||
if indexer_id is None:
|
if indexer_id is None and id:
|
||||||
indexer_id = found_info[1]
|
indexer_id = id
|
||||||
|
|
||||||
# found our info so continue
|
|
||||||
break
|
|
||||||
|
|
||||||
cur_dir['existing_info'] = (indexer_id, show_name, indexer)
|
cur_dir['existing_info'] = (indexer_id, show_name, indexer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user