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

Bugfix for indexerApi improperly returning list of indexers

This commit is contained in:
echel0n 2014-03-26 19:01:53 -07:00
parent 8004685d3f
commit dd58028ba6
8 changed files with 19 additions and 17 deletions

View File

@ -30,7 +30,7 @@
#end if
<td>
<select name="indexer">
#for $curIndexer in $sickbeard.indexerApi.indexers().items():
#for $curIndexer in $sickbeard.indexerApi().indexers.items():
<option value="$curIndexer[0]" #if $curIndexer[0] == $indexer then "selected=\"selected\"" else ""#>$curIndexer[1]</option>
#end for
</select>

View File

@ -942,7 +942,7 @@ def get_show_by_name(name, showList, useIndexer=False):
return show
if useIndexer:
for indexer in sickbeard.indexerApi.indexers():
for indexer in sickbeard.indexerApi().indexers:
try:
lINDEXER_API_PARMS = sickbeard.indexerApi(indexer).api_params.copy()
lINDEXER_API_PARMS['custom_ui'] = classes.ShowListUI

View File

@ -20,6 +20,7 @@ import sickbeard
from indexer_config import initConfig, indexerConfig
class indexerApi(object):
def __init__(self, indexerID=None):
self.indexerID = indexerID
@ -43,7 +44,7 @@ class indexerApi(object):
def api_params(self):
if self.indexerID:
if sickbeard.CACHE_DIR:
indexerConfig[self.indexerID]['api_params']['cache'] = os.path.join(sickbeard.CACHE_DIR, self.name)
indexerConfig[self.indexerID]['api_params']['cache'] = os.path.join(sickbeard.CACHE_DIR, self.name)
return indexerConfig[self.indexerID]['api_params']
@property
@ -51,6 +52,6 @@ class indexerApi(object):
if sickbeard.CACHE_DIR:
return self.api_params['cache']
@staticmethod
def indexers():
@property
def indexers(self):
return {k: v if k is 'id' else v['name'] for k, v in indexerConfig.items()}

View File

@ -284,7 +284,7 @@ class NameParser(object):
# see if we can find the name with a TVDB lookup
if check_indexer:
for cur_name in name_list:
for indexer in sickbeard.indexerApi.indexers():
for indexer in sickbeard.indexerApi().indexers:
try:
lINDEXER_API_PARMS = sickbeard.indexerApi(indexer).api_params.copy()

View File

@ -830,7 +830,7 @@ class PostProcessor(object):
# try to find the file info
indexer_id = season = episodes = None
for indexer in sickbeard.indexerApi.indexers():
for indexer in sickbeard.indexerApi().indexers:
self.indexer = int(indexer)
self._log(u"Searching " + sickbeard.indexerApi(self.indexer).name + ", trying to auto-detect Indexer for "

View File

@ -73,7 +73,7 @@ def retrieve_exceptions():
# exceptions are stored on github pages
for indexer in sickbeard.indexerApi.indexers():
for indexer in sickbeard.indexerApi().indexers:
logger.log(u"Checking for scene exception updates for " + sickbeard.indexerApi(indexer).name + "")
url = sickbeard.indexerApi(indexer).config['scene_url']

View File

@ -53,7 +53,7 @@ class ShowUpdater():
# clean out cache directory, remove everything > 12 hours old
if sickbeard.CACHE_DIR:
for indexer in sickbeard.indexerApi.indexers():
for indexer in sickbeard.indexerApi().indexers:
cache_dir = sickbeard.indexerApi(indexer).cache
logger.log(u"Trying to clean cache folder " + cache_dir)

View File

@ -179,7 +179,7 @@ def ManageMenu():
if sickbeard.USE_TORRENTS and sickbeard.TORRENT_METHOD != 'blackhole' \
and (sickbeard.ENABLE_HTTPS and sickbeard.TORRENT_HOST[:5] == 'https'
or not sickbeard.ENABLE_HTTPS and sickbeard.TORRENT_HOST[:5] == 'http:'):
or not sickbeard.ENABLE_HTTPS and sickbeard.TORRENT_HOST[:5] == 'http:'):
manageMenu.append({'title': 'Manage Torrents', 'path': 'manage/manageTorrents/'})
if sickbeard.USE_SUBTITLES:
@ -381,7 +381,7 @@ class Manage:
result[cur_season][cur_episode]["subtitles"] = ",".join(
subliminal.language.Language(subtitle).alpha2 for subtitle in cur_result["subtitles"].split(',')) if not \
cur_result["subtitles"] == '' else ''
cur_result["subtitles"] == '' else ''
return json.dumps(result)
@ -1976,7 +1976,7 @@ class NewHomeAddShows:
keywords.insert(0, nameUTF8)
# check for indexer preset
indexers = sickbeard.indexerApi.indexers if not int(indexer) else [int(indexer or 0)]
indexers = sickbeard.indexerApi().indexers if not int(indexer) else [int(indexer or 0)]
# Query Indexers for each search term and build the list of results
for indexer in indexers():
@ -1994,7 +1994,8 @@ class NewHomeAddShows:
results += [[sickbeard.indexerApi(indexer).name, int(sickbeard.indexerApi(indexer).config['id']),
sickbeard.indexerApi(indexer).config["show_url"], int(x['id']), x['seriesname'],
x['firstaired']] for x in search if x['firstaired']]
except:continue
except:
continue
# remove duplicates
results = list(results for results, _ in itertools.groupby(results))
@ -2066,7 +2067,7 @@ class NewHomeAddShows:
# default to TVDB if indexer was not detected
if show_name and (indexer is None or indexer_id is None):
for idx in sickbeard.indexerApi.indexers():
for idx in sickbeard.indexerApi().indexers:
found_info = helpers.searchIndexerForShowID(show_name, idx, indexer_id)
if found_info:
# set indexer and indexer_id from found info
@ -2573,7 +2574,7 @@ class Home:
result = notifiers.nmj_notifier.notify_settings(urllib.unquote_plus(host))
if result:
return '{"message": "Got settings from %(host)s", "database": "%(database)s", "mount": "%(mount)s"}' % {
"host": host, "database": sickbeard.NMJ_DATABASE, "mount": sickbeard.NMJ_MOUNT}
"host": host, "database": sickbeard.NMJ_DATABASE, "mount": sickbeard.NMJ_MOUNT}
else:
return '{"message": "Failed! Make sure your Popcorn is on and NMJ is running. (see Log & Errors -> Debug for detailed info)", "database": "", "mount": ""}'
@ -2599,7 +2600,7 @@ class Home:
"database": sickbeard.NMJv2_DATABASE}
else:
return '{"message": "Unable to find NMJ Database at location: %(dbloc)s. Is the right location selected and PCH running?", "database": ""}' % {
"dbloc": dbloc}
"dbloc": dbloc}
@cherrypy.expose
def testTrakt(self, api=None, username=None, password=None):
@ -3633,7 +3634,7 @@ class WebInterface:
# paused_item['title'] = 'Hide Paused' if sickbeard.COMING_EPS_DISPLAY_PAUSED else 'Show Paused'
paused_item = {'title': 'View Paused:', 'path': {'': ''}}
paused_item['path'] = {'Hide': 'toggleComingEpsDisplayPaused'} if sickbeard.COMING_EPS_DISPLAY_PAUSED else {
'Show': 'toggleComingEpsDisplayPaused'}
'Show': 'toggleComingEpsDisplayPaused'}
t.submenu = [
{'title': 'Sort by:', 'path': {'Date': 'setComingEpsSort/?sort=date',
'Show': 'setComingEpsSort/?sort=show',