mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Add CPU throttling preset "Disabled" to config/General/Advanced Settings and centralise the function.
This commit is contained in:
parent
3bcb4498ca
commit
6dd434fcba
7 changed files with 24 additions and 24 deletions
|
@ -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)
|
||||
|
|
|
@ -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 @@
|
|||
<span class="component-title">CPU throttling:</span>
|
||||
<span class="component-desc">
|
||||
<select id="cpu_presets" name="cpu_preset" class="form-control input-sm">
|
||||
#for $cur_preset in $cpu_presets
|
||||
<option value="$cur_preset"#echo ('', $selected)[$cur_preset == $sickbeard.CPU_PRESET]#>$cur_preset.capitalize()</option>
|
||||
#for $cur_preset in $sorted($cpu_presets.items(), key=$operator.itemgetter(1), reverse=True)
|
||||
<option value="$cur_preset[0]"#echo ('', $selected)[$cur_preset[0] == $sickbeard.CPU_PRESET]#>$cur_preset[0].capitalize()</option>
|
||||
#end for
|
||||
</select>
|
||||
<span>Normal (default). High is lower and Low is higher CPU use</span>
|
||||
|
@ -685,4 +686,4 @@
|
|||
//-->
|
||||
</script>
|
||||
|
||||
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|
||||
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in a new issue