Change IMDb updater to a toggleable option under General Settings (disabled by default due to slow operations)

This commit is contained in:
Adam 2015-03-12 23:42:32 +08:00
parent 722ffbe2b3
commit 42b5fe7570
5 changed files with 37 additions and 18 deletions

View file

@ -27,6 +27,7 @@
* Change database code to PEP8 standards
* Change general config's branches and pull request list generation for faster page loading
* Add PlayStation Network logo
* Change IMDb updater to a toggleable option under General Settings (disabled by default due to slow operations)
[develop changelog]
* Fix traceback error when using the menu item Manage/Update Kodi

View file

@ -132,6 +132,16 @@
</label>
</div>
<div class="field-pair">
<label for="use_imdb">
<span class="component-title">Enable IMDb info</span>
<span class="component-desc">
<input type="checkbox" name="use_imdb" id="use_imdb" #if $sickbeard.USE_IMDB then 'checked="checked"' else ''#>
<p>fetches show rating and country flag (does slow show updating process)</p>
</span>
</label>
</div>
<div class="field-pair">
<label>
<span class="component-title">Show root directories</span>

View file

@ -172,6 +172,7 @@ INDEXER_DEFAULT = None
INDEXER_TIMEOUT = None
SCENE_DEFAULT = False
ANIME_DEFAULT = False
USE_IMDB = False
PROVIDER_ORDER = []
NAMING_MULTI_EP = False
@ -522,7 +523,7 @@ def initialize(consoleLogging=True):
AUTOPOSTPROCESSER_FREQUENCY, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \
ANIME_DEFAULT, NAMING_ANIME, ANIMESUPPORT, USE_ANIDB, ANIDB_USERNAME, ANIDB_PASSWORD, ANIDB_USE_MYLIST, \
ANIME_SPLIT_HOME, SCENE_DEFAULT, BACKLOG_DAYS, ANIME_TREAT_AS_HDTV, \
COOKIE_SECRET
COOKIE_SECRET, USE_IMDB
if __INITIALIZED__:
return False
@ -659,6 +660,7 @@ def initialize(consoleLogging=True):
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))
USE_IMDB = bool(check_setting_int(CFG, 'General', 'use_imdb', 0))
PROVIDER_ORDER = check_setting_str(CFG, 'General', 'provider_order', '').split()
@ -1443,6 +1445,7 @@ def save_config():
new_config['General']['indexer_timeout'] = int(INDEXER_TIMEOUT)
new_config['General']['anime_default'] = int(ANIME_DEFAULT)
new_config['General']['scene_default'] = int(SCENE_DEFAULT)
new_config['General']['use_imdb'] = int(USE_IMDB)
new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER)
new_config['General']['version_notify'] = int(VERSION_NOTIFY)
new_config['General']['auto_update'] = int(AUTO_UPDATE)

View file

@ -336,14 +336,15 @@ class QueueItemAdd(ShowQueueItem):
self._finishEarly()
raise
logger.log(u"Retrieving show info from IMDb", logger.DEBUG)
try:
self.show.loadIMDbInfo()
except imdb_exceptions.IMDbError, e:
#todo Insert UI notification
logger.log(u"Something is wrong with IMDb api: " + ex(e), logger.WARNING)
except Exception, e:
logger.log(u"Error loading IMDb info: " + ex(e), logger.ERROR)
if sickbeard.USE_IMDB:
logger.log(u'Retrieving show info from IMDb', logger.DEBUG)
try:
self.show.loadIMDbInfo()
except imdb_exceptions.IMDbError, e:
#todo Insert UI notification
logger.log(u'Something is wrong with IMDb api: ' + ex(e), logger.WARNING)
except Exception, e:
logger.log(u'Error loading IMDb info: ' + ex(e), logger.ERROR)
try:
self.show.saveToDB()
@ -520,14 +521,15 @@ class QueueItemUpdate(ShowQueueItem):
self.show.indexer).name + " was incomplete, aborting: " + ex(e), logger.ERROR)
return
logger.log(u"Retrieving show info from IMDb", logger.DEBUG)
try:
self.show.loadIMDbInfo()
except imdb_exceptions.IMDbError, e:
logger.log(u"Something is wrong with IMDb api: " + ex(e), logger.WARNING)
except Exception, e:
logger.log(u"Error loading IMDb info: " + ex(e), logger.ERROR)
logger.log(traceback.format_exc(), logger.DEBUG)
if sickbeard.USE_IMDB:
logger.log(u'Retrieving show info from IMDb', logger.DEBUG)
try:
self.show.loadIMDbInfo()
except imdb_exceptions.IMDbError, e:
logger.log(u'Something is wrong with IMDb api: ' + ex(e), logger.WARNING)
except Exception, e:
logger.log(u'Error loading IMDb info: ' + ex(e), logger.ERROR)
logger.log(traceback.format_exc(), logger.DEBUG)
try:
self.show.saveToDB()

View file

@ -3356,7 +3356,7 @@ class ConfigGeneral(Config):
handle_reverse_proxy=None, home_search_focus=None, sort_article=None, auto_update=None, notify_on_update=None,
proxy_setting=None, proxy_indexers=None, anon_redirect=None, git_path=None, git_remote=None, calendar_unprotected=None,
fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None,
indexer_timeout=None, rootDir=None, theme_name=None, default_home=None):
indexer_timeout=None, use_imdb=None, rootDir=None, theme_name=None, default_home=None):
results = []
@ -3412,6 +3412,9 @@ class ConfigGeneral(Config):
if indexer_timeout:
sickbeard.INDEXER_TIMEOUT = config.to_int(indexer_timeout)
if use_imdb:
sickbeard.USE_IMDB = config.checkbox_to_value(use_imdb)
if time_preset:
sickbeard.TIME_PRESET_W_SECONDS = time_preset
sickbeard.TIME_PRESET = sickbeard.TIME_PRESET_W_SECONDS.replace(u':%S', u'')