diff --git a/CHANGES.md b/CHANGES.md
index 5c2517c1..14271fc9 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -103,6 +103,7 @@
* Add option to create season search exceptions from editShow page
* Change sab to use requests library
* Add "View Changes" to tools menu
+* Change disable connection attempts and remove UI references to the TVRage info source
### 0.10.0 (2015-08-06 11:05:00 UTC)
diff --git a/gui/slick/interfaces/default/config_general.tmpl b/gui/slick/interfaces/default/config_general.tmpl
index ece49e06..4021ad1e 100644
--- a/gui/slick/interfaces/default/config_general.tmpl
+++ b/gui/slick/interfaces/default/config_general.tmpl
@@ -122,22 +122,22 @@
-
+#if 1 < $len($indexers)
-
+#end if
diff --git a/gui/slick/interfaces/default/home_massAddTable.tmpl b/gui/slick/interfaces/default/home_massAddTable.tmpl
index 96aa8246..b27181e1 100644
--- a/gui/slick/interfaces/default/home_massAddTable.tmpl
+++ b/gui/slick/interfaces/default/home_massAddTable.tmpl
@@ -31,13 +31,16 @@
#set $indexer = $curDir['existing_info'][2]
#end if
+ #set $indexer = $sickbeard.INDEXER_DEFAULT
+
+#*
#set $indexer = 0
#if $curDir['existing_info'][0]
#set $indexer = $curDir['existing_info'][2]
#elif 0 < $sickbeard.INDEXER_DEFAULT
#set $indexer = $sickbeard.INDEXER_DEFAULT
#end if
-
+*#
@@ -58,7 +61,9 @@
|
|
diff --git a/gui/slick/interfaces/default/home_newShow.tmpl b/gui/slick/interfaces/default/home_newShow.tmpl
index f8eb5166..f62c723e 100644
--- a/gui/slick/interfaces/default/home_newShow.tmpl
+++ b/gui/slick/interfaces/default/home_newShow.tmpl
@@ -49,20 +49,29 @@
#else
+ #if 2 > $len($indexers)
+
+
+ #end if
- *
-
-
-
+ *
+
+ #if 1 < $len($indexers)
+
+ #end if
+
+
Enter show name, TVDB ID, IMDb Url, or IMDb ID. *SickGear supports english, language is used for show/episode data
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py
index 0158628f..bb0b6eab 100755
--- a/sickbeard/__init__.py
+++ b/sickbeard/__init__.py
@@ -38,6 +38,7 @@ from sickbeard import helpers, logger, db, naming, metadata, providers, scene_ex
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, ConfigMigrator, minimax
from sickbeard.common import SD, SKIPPED
from sickbeard.databases import mainDB, cache_db, failed_db
+from indexers.indexer_config import INDEXER_TVDB
from indexers.indexer_api import indexerApi
from indexers.indexer_exceptions import indexer_shownotfound, indexer_exception, indexer_error, \
indexer_episodenotfound, indexer_attributenotfound, indexer_seasonnotfound, indexer_userabort, indexerExcepts
@@ -667,6 +668,8 @@ def initialize(consoleLogging=True):
NOTIFY_ON_UPDATE = bool(check_setting_int(CFG, 'General', 'notify_on_update', 1))
FLATTEN_FOLDERS_DEFAULT = bool(check_setting_int(CFG, 'General', 'flatten_folders_default', 0))
INDEXER_DEFAULT = check_setting_int(CFG, 'General', 'indexer_default', 0)
+ if INDEXER_DEFAULT and not indexerApi(INDEXER_DEFAULT).config['active']:
+ INDEXER_DEFAULT = INDEXER_TVDB
INDEXER_TIMEOUT = check_setting_int(CFG, 'General', 'indexer_timeout', 20)
ANIME_DEFAULT = bool(check_setting_int(CFG, 'General', 'anime_default', 0))
SCENE_DEFAULT = bool(check_setting_int(CFG, 'General', 'scene_default', 0))
diff --git a/sickbeard/indexers/indexer_api.py b/sickbeard/indexers/indexer_api.py
index f2adff71..1b29e8d6 100644
--- a/sickbeard/indexers/indexer_api.py
+++ b/sickbeard/indexers/indexer_api.py
@@ -17,10 +17,63 @@
# along with SickGear. If not, see .
import os
import sickbeard
+import time
from indexer_config import initConfig, indexerConfig
from sickbeard.helpers import proxy_setting
+
+class ShowContainer(dict):
+ """Simple dict that holds a series of Show instances
+ """
+
+ def __init__(self):
+ self._stack = []
+ self._lastgc = time.time()
+
+ def __setitem__(self, key, value):
+ self._stack.append(key)
+
+ # keep only the 100th latest results
+ if time.time() - self._lastgc > 20:
+ for o in self._stack[:-100]:
+ del self[o]
+
+ self._stack = self._stack[-100:]
+
+ self._lastgc = time.time()
+
+ super(ShowContainer, self).__setitem__(key, value)
+
+
+class DummyIndexer:
+ def __init__(self, *args, **kwargs):
+ self.config = {
+ 'apikey': '',
+ 'debug_enabled': False,
+ 'custom_ui': None,
+ 'proxy': None,
+ 'cache_enabled': False,
+ 'cache_location': '',
+ 'valid_languages': [],
+ 'langabbv_to_id': {},
+ 'language': 'en',
+ 'base_url': '',
+ }
+
+ self.corrections = {}
+ self.shows = ShowContainer()
+
+ def __getitem__(self, key):
+ return None
+
+ def __repr__(self):
+ return str(self.shows)
+
+ def search(self, series):
+ return []
+
+
class indexerApi(object):
def __init__(self, indexerID=None):
self.indexerID = int(indexerID) if indexerID else None
@@ -30,7 +83,10 @@ class indexerApi(object):
def indexer(self, *args, **kwargs):
if self.indexerID:
- return indexerConfig[self.indexerID]['module'](*args, **kwargs)
+ if indexerConfig[self.indexerID]['active']:
+ return indexerConfig[self.indexerID]['module'](*args, **kwargs)
+ else:
+ return DummyIndexer(*args, **kwargs)
@property
def config(self):
diff --git a/sickbeard/indexers/indexer_config.py b/sickbeard/indexers/indexer_config.py
index 8764dcbc..68e9895a 100644
--- a/sickbeard/indexers/indexer_config.py
+++ b/sickbeard/indexers/indexer_config.py
@@ -25,6 +25,7 @@ indexerConfig[INDEXER_TVDB] = {
'language': 'en',
'useZip': True,
},
+ 'active': True,
}
indexerConfig[INDEXER_TVRAGE] = {
@@ -34,6 +35,7 @@ indexerConfig[INDEXER_TVRAGE] = {
'api_params': {'apikey': 'Uhewg1Rr0o62fvZvUIZt',
'language': 'en',
},
+ 'active': False,
}
# TVDB Indexer Settings
diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py
index 0539399e..db018ccb 100644
--- a/sickbeard/providers/generic.py
+++ b/sickbeard/providers/generic.py
@@ -556,7 +556,7 @@ class GenericProvider:
value *= 1024 ** ['b', 'k', 'm', 'g', 't'].index(re.findall('(t|g|m|k)[i]?b', size_dim.lower())[0])
except IndexError:
pass
- return int(math.ceil(value))
+ return long(math.ceil(value))
class NZBProvider(object, GenericProvider):
diff --git a/sickbeard/show_queue.py b/sickbeard/show_queue.py
index c2ff930b..907602f1 100644
--- a/sickbeard/show_queue.py
+++ b/sickbeard/show_queue.py
@@ -578,6 +578,11 @@ class QueueItemUpdate(ShowQueueItem):
ShowQueueItem.run(self)
+ if not sickbeard.indexerApi(self.show.indexer).config['active']:
+ logger.log(u'Indexer %s is marked inactive, aborting update for show %s and continue with refresh.' % (sickbeard.indexerApi(self.show.indexer).config['name'], self.show.name))
+ sickbeard.showQueueScheduler.action.refreshShow(self.show, self.force, self.scheduled_update, after_update=True)
+ return
+
logger.log(u'Beginning update of ' + self.show.name)
logger.log(u'Retrieving show info from ' + sickbeard.indexerApi(self.show.indexer).name + '', logger.DEBUG)
diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py
index d894a24b..50c0cc6f 100644
--- a/sickbeard/webserve.py
+++ b/sickbeard/webserve.py
@@ -2316,7 +2316,8 @@ class NewHomeAddShows(Home):
t.provided_show_dir = show_dir
t.other_shows = other_shows
t.provided_indexer = int(indexer or sickbeard.INDEXER_DEFAULT)
- t.indexers = sickbeard.indexerApi().indexers
+ t.indexers = dict([(i, sickbeard.indexerApi().indexers[i]) for i in sickbeard.indexerApi().indexers
+ if sickbeard.indexerApi(i).config['active']])
t.whitelist = []
t.blacklist = []
t.groups = []
@@ -3744,6 +3745,8 @@ class ConfigGeneral(Config):
t = PageTemplate(headers=self.request.headers, file='config_general.tmpl')
t.submenu = self.ConfigMenu
t.show_tags = ', '.join(sickbeard.SHOW_TAGS)
+ t.indexers = dict([(i, sickbeard.indexerApi().indexers[i]) for i in sickbeard.indexerApi().indexers
+ if sickbeard.indexerApi(i).config['active']])
return t.respond()
def saveRootDirs(self, rootDirString=None):
@@ -3876,6 +3879,8 @@ class ConfigGeneral(Config):
if indexer_default:
sickbeard.INDEXER_DEFAULT = config.to_int(indexer_default)
+ if not sickbeard.indexerApi(sickbeard.INDEXER_DEFAULT).config['active']:
+ sickbeard.INDEXER_DEFAULT = INDEXER_TVDB
if indexer_timeout:
sickbeard.INDEXER_TIMEOUT = config.to_int(indexer_timeout)