diff --git a/CHANGES.md b/CHANGES.md
index 4bc7a90f..8715e8a5 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -29,6 +29,7 @@
* Change handle all Hachoir library parser errors and replace its Unicode enforcement
* Allow episode status "Skipped" to be changed to "Downloaded"
* Allow found "Skipped" episode files to be set "Unknown" quality
+* Add CPU throttling preset "Disabled" to config/General/Advanced Settings
### 0.11.5 (2016-02-01 19:40:00 UTC)
diff --git a/gui/slick/interfaces/default/config_general.tmpl b/gui/slick/interfaces/default/config_general.tmpl
index 4021ad1e..cc615abc 100644
--- a/gui/slick/interfaces/default/config_general.tmpl
+++ b/gui/slick/interfaces/default/config_general.tmpl
@@ -1,6 +1,7 @@
#import sickbeard
#import datetime
#import locale
+#import operator
#from sickbeard.common import *
#from sickbeard.sbdatetime import *
#from sickbeard import config
@@ -590,8 +591,8 @@
CPU throttling:
Normal (default). High is lower and Low is higher CPU use
@@ -685,4 +686,4 @@
//-->
-#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
\ No newline at end of file
+#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
diff --git a/sickbeard/common.py b/sickbeard/common.py
index 7282ade3..c9514414 100644
--- a/sickbeard/common.py
+++ b/sickbeard/common.py
@@ -36,7 +36,7 @@ mediaExtensions = ['avi', 'mkv', 'mpg', 'mpeg', 'wmv', 'ogm', 'mp4', 'iso', 'img
subtitleExtensions = ['srt', 'sub', 'ass', 'idx', 'ssa']
-cpu_presets = {'LOW': 0.01, 'NORMAL': 0.05, 'HIGH': 0.1}
+cpu_presets = {'DISABLED': 0, 'LOW': 0.01, 'NORMAL': 0.05, 'HIGH': 0.1}
# Other constants
MULTI_EP_RESULT = -1
diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py
index e0cbb258..72078156 100644
--- a/sickbeard/helpers.py
+++ b/sickbeard/helpers.py
@@ -52,7 +52,7 @@ except ImportError:
from sickbeard.exceptions import MultipleShowObjectsException, ex
from sickbeard import logger, classes, db, notifiers, clients
-from sickbeard.common import USER_AGENT, mediaExtensions, subtitleExtensions
+from sickbeard.common import USER_AGENT, mediaExtensions, subtitleExtensions, cpu_presets
from sickbeard import encodingKludge as ek
from lib.cachecontrol import CacheControl, caches
@@ -1444,3 +1444,8 @@ def make_search_segment_html_string(segment, max_eps=5):
def has_anime():
return False if not sickbeard.showList else any(filter(lambda show: show.is_anime, sickbeard.showList))
+
+
+def cpu_sleep():
+ if cpu_presets[sickbeard.CPU_PRESET]:
+ time.sleep(cpu_presets[sickbeard.CPU_PRESET])
diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py
index e0946daa..f5a0c4ad 100644
--- a/sickbeard/name_parser/parser.py
+++ b/sickbeard/name_parser/parser.py
@@ -28,7 +28,6 @@ import sickbeard
from sickbeard import logger, helpers, scene_numbering, common, scene_exceptions, encodingKludge as ek, db
from sickbeard.exceptions import ex
-from sickbeard.common import cpu_presets
class NameParser(object):
@@ -338,8 +337,7 @@ class NameParser(object):
% (best_result.original_name, str(best_result).decode('utf-8', 'xmlcharrefreplace')),
logger.DEBUG)
- # CPU sleep
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
return best_result
diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py
index 75cf0723..5f53f37d 100644
--- a/sickbeard/search_queue.py
+++ b/sickbeard/search_queue.py
@@ -213,8 +213,7 @@ class RecentSearchQueueItem(generic_queue.QueueItem):
logger.log(u'Downloading %s from %s' % (result.name, result.provider.name))
self.success = search.snatch_episode(result)
- # give the CPU a break
- time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
except Exception:
logger.log(traceback.format_exc(), logger.DEBUG)
@@ -345,8 +344,7 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
logger.log(u'Downloading %s from %s' % (search_result[0].name, search_result[0].provider.name))
self.success = search.snatch_episode(search_result[0])
- # give the CPU a break
- time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
else:
ui.notifications.message('No downloads found',
@@ -392,8 +390,7 @@ class BacklogQueueItem(generic_queue.QueueItem):
logger.log(u'Downloading %s from %s' % (result.name, result.provider.name))
search.snatch_episode(result)
- # give the CPU a break
- time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
else:
logger.log(u'No needed episodes found during backlog search for: [%s]' % self.show.name)
except Exception:
@@ -440,8 +437,7 @@ class FailedQueueItem(generic_queue.QueueItem):
logger.log(u'Downloading %s from %s' % (result.name, result.provider.name))
search.snatch_episode(result)
- # give the CPU a break
- time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
else:
pass
# logger.log(u'No valid episode found to retry for: [%s]' % self.segment.prettyName())
diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py
index 217c705f..6d7b6280 100644
--- a/sickbeard/webserve.py
+++ b/sickbeard/webserve.py
@@ -39,7 +39,7 @@ from sickbeard import config, sab, clients, history, notifiers, processTV, ui, l
db, search_queue, image_cache, naming, scene_exceptions, subtitles, network_timezones, sbdatetime
from sickbeard import encodingKludge as ek
from sickbeard.providers import newznab, rsstorrent
-from sickbeard.common import Quality, Overview, statusStrings, qualityPresetStrings, cpu_presets
+from sickbeard.common import Quality, Overview, statusStrings, qualityPresetStrings
from sickbeard.common import SNATCHED, UNAIRED, IGNORED, ARCHIVED, WANTED, FAILED, SKIPPED
from sickbeard.common import SD, HD720p, HD1080p
from sickbeard.exceptions import ex
@@ -1509,7 +1509,7 @@ class Home(MainHandler):
if do_update:
try:
sickbeard.showQueueScheduler.action.updateShow(showObj, True) # @UndefinedVariable
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
except exceptions.CantUpdateException as e:
errors.append('Unable to force an update on the show.')
@@ -1517,14 +1517,14 @@ class Home(MainHandler):
try:
scene_exceptions.update_scene_exceptions(showObj.indexerid, exceptions_list) # @UndefinedVdexerid)
buildNameCache(showObj)
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
except exceptions.CantUpdateException as e:
errors.append('Unable to force an update on scene exceptions of the show.')
if do_update_scene_numbering:
try:
sickbeard.scene_numbering.xem_refresh(showObj.indexerid, showObj.indexer) # @UndefinedVariable
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
except exceptions.CantUpdateException as e:
errors.append('Unable to force an update on scene numbering of the show.')
@@ -1579,7 +1579,7 @@ class Home(MainHandler):
ui.notifications.error('Unable to refresh this show.',
ex(e))
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
self.redirect('/home/displayShow?show=' + str(showObj.indexerid))
@@ -1600,8 +1600,7 @@ class Home(MainHandler):
ui.notifications.error('Unable to update this show.',
ex(e))
- # just give it some time
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
self.redirect('/home/displayShow?show=' + str(showObj.indexerid))
@@ -1618,7 +1617,7 @@ class Home(MainHandler):
# search and download subtitles
sickbeard.showQueueScheduler.action.downloadSubtitles(showObj, bool(force)) # @UndefinedVariable
- time.sleep(cpu_presets[sickbeard.CPU_PRESET])
+ helpers.cpu_sleep()
self.redirect('/home/displayShow?show=' + str(showObj.indexerid))