mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 09:07:43 +00:00
Change disable connection attempts and remove UI references to the TVRage info source.
Change TVDB to be the default indexer if selected indexer is not configured active. Change add dummyIndexer for inactive Indexers. Change don't update show for indexer that are marked inactive.
This commit is contained in:
parent
9444c49bda
commit
0bbaefe17b
10 changed files with 106 additions and 20 deletions
|
@ -103,6 +103,7 @@
|
||||||
* Add option to create season search exceptions from editShow page
|
* Add option to create season search exceptions from editShow page
|
||||||
* Change sab to use requests library
|
* Change sab to use requests library
|
||||||
* Add "View Changes" to tools menu
|
* 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)
|
### 0.10.0 (2015-08-06 11:05:00 UTC)
|
||||||
|
|
|
@ -122,22 +122,22 @@
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
#if 1 < $len($indexers)
|
||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label for="indexer_default">
|
<label for="indexer_default">
|
||||||
<span class="component-title">Use initial indexer set to</span>
|
<span class="component-title">Use initial indexer set to</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
<select id="indexer_default" name="indexer_default" class="form-control input-sm">
|
<select id="indexer_default" name="indexer_default" class="form-control input-sm">
|
||||||
<option value="0"#echo ('', $selected)[0 == $indexer]#>All Indexers</option>
|
<option value="0"#echo ('', $selected)[0 == $indexer]#>All Indexers</option>
|
||||||
#for $indexer in $sickbeard.indexerApi().indexers
|
#for $indexer in $indexers
|
||||||
<option value="$indexer"#echo ('', $selected)[$indexer == $sickbeard.INDEXER_DEFAULT]#>$sickbeard.indexerApi().indexers[$indexer]</option>
|
<option value="$indexer"#echo ('', $selected)[$indexer == $sickbeard.INDEXER_DEFAULT]#>$sickbeard.indexerApi().indexers[$indexer]</option>
|
||||||
#end for
|
#end for
|
||||||
</select>
|
</select>
|
||||||
<span>as the default selection when adding new shows</span>
|
<span>as the default selection when adding new shows</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
#end if
|
||||||
<div class="field-pair">
|
<div class="field-pair">
|
||||||
<label for="indexer_timeout">
|
<label for="indexer_timeout">
|
||||||
<span class="component-title">Timeout show indexer at</span>
|
<span class="component-title">Timeout show indexer at</span>
|
||||||
|
@ -636,7 +636,7 @@
|
||||||
<span class="component-title">Use proxy for indexers</span>
|
<span class="component-title">Use proxy for indexers</span>
|
||||||
<span class="component-desc">
|
<span class="component-desc">
|
||||||
<input type="checkbox" name="proxy_indexers" id="proxy_indexers"#echo ('', $checked)[True == $sickbeard.PROXY_INDEXERS]#>
|
<input type="checkbox" name="proxy_indexers" id="proxy_indexers"#echo ('', $checked)[True == $sickbeard.PROXY_INDEXERS]#>
|
||||||
<p>use proxy host for connecting to indexers (thetvdb, tvrage)</p>
|
<p>use proxy host for TV info source connections</p>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,13 +31,16 @@
|
||||||
#set $indexer = $curDir['existing_info'][2]
|
#set $indexer = $curDir['existing_info'][2]
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
|
#set $indexer = $sickbeard.INDEXER_DEFAULT
|
||||||
|
|
||||||
|
#*
|
||||||
#set $indexer = 0
|
#set $indexer = 0
|
||||||
#if $curDir['existing_info'][0]
|
#if $curDir['existing_info'][0]
|
||||||
#set $indexer = $curDir['existing_info'][2]
|
#set $indexer = $curDir['existing_info'][2]
|
||||||
#elif 0 < $sickbeard.INDEXER_DEFAULT
|
#elif 0 < $sickbeard.INDEXER_DEFAULT
|
||||||
#set $indexer = $sickbeard.INDEXER_DEFAULT
|
#set $indexer = $sickbeard.INDEXER_DEFAULT
|
||||||
#end if
|
#end if
|
||||||
|
*#
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-checkbox">
|
<td class="col-checkbox">
|
||||||
<input type="checkbox" id="$show_id" class="dirCheck" checked=checked>
|
<input type="checkbox" id="$show_id" class="dirCheck" checked=checked>
|
||||||
|
@ -58,7 +61,9 @@
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<select name="indexer">
|
<select name="indexer">
|
||||||
#for $curIndexer in $sickbeard.indexerApi().indexers.items()
|
#for $curIndexer in $sickbeard.indexerApi().indexers.items()
|
||||||
|
#if $curIndexer[0] == $sickbeard.INDEXER_DEFAULT
|
||||||
<option value="$curIndexer[0]" #if $curIndexer[0] == $indexer then 'selected="selected"' else ''#>$curIndexer[1]</option>
|
<option value="$curIndexer[0]" #if $curIndexer[0] == $indexer then 'selected="selected"' else ''#>$curIndexer[1]</option>
|
||||||
|
#end if
|
||||||
#end for
|
#end for
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -49,20 +49,29 @@
|
||||||
<input type="hidden" id="providedName" value="$provided_indexer_name" />
|
<input type="hidden" id="providedName" value="$provided_indexer_name" />
|
||||||
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
||||||
#else
|
#else
|
||||||
|
#if 2 > $len($indexers)
|
||||||
|
<style>
|
||||||
|
#addShowForm input#nameToSearch{width:611px}
|
||||||
|
</style>
|
||||||
|
<input type="hidden" id="providedIndexer" value="$provided_indexer" />
|
||||||
|
#end if
|
||||||
<input type="text" id="nameToSearch" value="$default_show_name" class="form-control form-control-inline input-sm input350" />
|
<input type="text" id="nameToSearch" value="$default_show_name" class="form-control form-control-inline input-sm input350" />
|
||||||
|
|
||||||
<span style="float:right">
|
<span style="float:right">
|
||||||
<select name="indexerLang" id="indexerLangSelect" class="form-control form-control-inline input-sm">
|
<select name="indexerLang" id="indexerLangSelect" class="form-control form-control-inline input-sm">
|
||||||
<option value="en" selected="selected">en</option>
|
<option value="en" selected="selected">en</option>
|
||||||
</select><b> *</b>
|
</select><b> *</b>
|
||||||
<select name="providedIndexer" id="providedIndexer" class="form-control form-control-inline input-sm">
|
|
||||||
<option value="0" #if $provided_indexer == 0 then "selected=\"selected\"" else ""#>All Indexers</option>
|
#if 1 < $len($indexers)
|
||||||
#for $indexer in $indexers
|
<select name="providedIndexer" id="providedIndexer" class="form-control form-control-inline input-sm">
|
||||||
<option value="$indexer" #if $provided_indexer == $indexer then "selected=\"selected\"" else ""#>$indexers[$indexer]</option>
|
<option value="0" #if $provided_indexer == 0 then "selected=\"selected\"" else ""#>All Indexers</option>
|
||||||
#end for
|
#for $indexer in $indexers
|
||||||
</select>
|
<option value="$indexer" #if $provided_indexer == $indexer then "selected=\"selected\"" else ""#>$indexers[$indexer]</option>
|
||||||
|
#end for
|
||||||
<input class="btn btn-inline" type="button" id="searchName" value="Search" />
|
</select>
|
||||||
|
#end if
|
||||||
|
|
||||||
|
<input class="btn btn-inline" type="button" id="searchName" value="Search" />
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<p style="margin:5px 0 15px">Enter show name, TVDB ID, IMDb Url, or IMDb ID. <b>*</b>SickGear supports english, language is used for show/episode data</p>
|
<p style="margin:5px 0 15px">Enter show name, TVDB ID, IMDb Url, or IMDb ID. <b>*</b>SickGear supports english, language is used for show/episode data</p>
|
||||||
|
|
|
@ -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.config import CheckSection, check_setting_int, check_setting_str, ConfigMigrator, minimax
|
||||||
from sickbeard.common import SD, SKIPPED
|
from sickbeard.common import SD, SKIPPED
|
||||||
from sickbeard.databases import mainDB, cache_db, failed_db
|
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_api import indexerApi
|
||||||
from indexers.indexer_exceptions import indexer_shownotfound, indexer_exception, indexer_error, \
|
from indexers.indexer_exceptions import indexer_shownotfound, indexer_exception, indexer_error, \
|
||||||
indexer_episodenotfound, indexer_attributenotfound, indexer_seasonnotfound, indexer_userabort, indexerExcepts
|
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))
|
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))
|
FLATTEN_FOLDERS_DEFAULT = bool(check_setting_int(CFG, 'General', 'flatten_folders_default', 0))
|
||||||
INDEXER_DEFAULT = check_setting_int(CFG, 'General', 'indexer_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)
|
INDEXER_TIMEOUT = check_setting_int(CFG, 'General', 'indexer_timeout', 20)
|
||||||
ANIME_DEFAULT = bool(check_setting_int(CFG, 'General', 'anime_default', 0))
|
ANIME_DEFAULT = bool(check_setting_int(CFG, 'General', 'anime_default', 0))
|
||||||
SCENE_DEFAULT = bool(check_setting_int(CFG, 'General', 'scene_default', 0))
|
SCENE_DEFAULT = bool(check_setting_int(CFG, 'General', 'scene_default', 0))
|
||||||
|
|
|
@ -17,10 +17,63 @@
|
||||||
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
||||||
import os
|
import os
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
import time
|
||||||
|
|
||||||
from indexer_config import initConfig, indexerConfig
|
from indexer_config import initConfig, indexerConfig
|
||||||
from sickbeard.helpers import proxy_setting
|
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):
|
class indexerApi(object):
|
||||||
def __init__(self, indexerID=None):
|
def __init__(self, indexerID=None):
|
||||||
self.indexerID = int(indexerID) if indexerID else None
|
self.indexerID = int(indexerID) if indexerID else None
|
||||||
|
@ -30,7 +83,10 @@ class indexerApi(object):
|
||||||
|
|
||||||
def indexer(self, *args, **kwargs):
|
def indexer(self, *args, **kwargs):
|
||||||
if self.indexerID:
|
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
|
@property
|
||||||
def config(self):
|
def config(self):
|
||||||
|
|
|
@ -25,6 +25,7 @@ indexerConfig[INDEXER_TVDB] = {
|
||||||
'language': 'en',
|
'language': 'en',
|
||||||
'useZip': True,
|
'useZip': True,
|
||||||
},
|
},
|
||||||
|
'active': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
indexerConfig[INDEXER_TVRAGE] = {
|
indexerConfig[INDEXER_TVRAGE] = {
|
||||||
|
@ -34,6 +35,7 @@ indexerConfig[INDEXER_TVRAGE] = {
|
||||||
'api_params': {'apikey': 'Uhewg1Rr0o62fvZvUIZt',
|
'api_params': {'apikey': 'Uhewg1Rr0o62fvZvUIZt',
|
||||||
'language': 'en',
|
'language': 'en',
|
||||||
},
|
},
|
||||||
|
'active': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
# TVDB Indexer Settings
|
# TVDB Indexer Settings
|
||||||
|
|
|
@ -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])
|
value *= 1024 ** ['b', 'k', 'm', 'g', 't'].index(re.findall('(t|g|m|k)[i]?b', size_dim.lower())[0])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
return int(math.ceil(value))
|
return long(math.ceil(value))
|
||||||
|
|
||||||
|
|
||||||
class NZBProvider(object, GenericProvider):
|
class NZBProvider(object, GenericProvider):
|
||||||
|
|
|
@ -578,6 +578,11 @@ class QueueItemUpdate(ShowQueueItem):
|
||||||
|
|
||||||
ShowQueueItem.run(self)
|
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'Beginning update of ' + self.show.name)
|
||||||
|
|
||||||
logger.log(u'Retrieving show info from ' + sickbeard.indexerApi(self.show.indexer).name + '', logger.DEBUG)
|
logger.log(u'Retrieving show info from ' + sickbeard.indexerApi(self.show.indexer).name + '', logger.DEBUG)
|
||||||
|
|
|
@ -2316,7 +2316,8 @@ class NewHomeAddShows(Home):
|
||||||
t.provided_show_dir = show_dir
|
t.provided_show_dir = show_dir
|
||||||
t.other_shows = other_shows
|
t.other_shows = other_shows
|
||||||
t.provided_indexer = int(indexer or sickbeard.INDEXER_DEFAULT)
|
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.whitelist = []
|
||||||
t.blacklist = []
|
t.blacklist = []
|
||||||
t.groups = []
|
t.groups = []
|
||||||
|
@ -3744,6 +3745,8 @@ class ConfigGeneral(Config):
|
||||||
t = PageTemplate(headers=self.request.headers, file='config_general.tmpl')
|
t = PageTemplate(headers=self.request.headers, file='config_general.tmpl')
|
||||||
t.submenu = self.ConfigMenu
|
t.submenu = self.ConfigMenu
|
||||||
t.show_tags = ', '.join(sickbeard.SHOW_TAGS)
|
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()
|
return t.respond()
|
||||||
|
|
||||||
def saveRootDirs(self, rootDirString=None):
|
def saveRootDirs(self, rootDirString=None):
|
||||||
|
@ -3876,6 +3879,8 @@ class ConfigGeneral(Config):
|
||||||
|
|
||||||
if indexer_default:
|
if indexer_default:
|
||||||
sickbeard.INDEXER_DEFAULT = config.to_int(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:
|
if indexer_timeout:
|
||||||
sickbeard.INDEXER_TIMEOUT = config.to_int(indexer_timeout)
|
sickbeard.INDEXER_TIMEOUT = config.to_int(indexer_timeout)
|
||||||
|
|
Loading…
Reference in a new issue