Browse Source

Add to config/General, "Package updates" > include in 'Check for Updates' menu action.

Change hide update section UI settings based on selections.
tags/release_0.25.1
JackDandy 4 years ago
parent
commit
41701f1508
  1. 1
      CHANGES.md
  2. 58
      gui/slick/interfaces/default/config_general.tmpl
  3. 24
      gui/slick/js/config.js
  4. 5
      sickbeard/__init__.py
  5. 8
      sickbeard/version_checker.py
  6. 4
      sickbeard/webserve.py

1
CHANGES.md

@ -24,6 +24,7 @@
* Fix update runner using shell that doesn't have env path to git binary in Linux (use `git pull` to get this fix)
* Fix under py2, a hachoir config value, without 'readline' sys.module, using the `--daemon` SG startup option, fails
* Change remove pycryptodome from recommended.txt as only used for removed py7z
* Add to config/General, "Package updates" > include in 'Check for Updates' menu action
### 0.23.3 (2020-11-30 17:20:00 UTC)

58
gui/slick/interfaces/default/config_general.tmpl

@ -178,21 +178,22 @@
<span class="component-title">Software updates</span>
<span class="component-desc">
<label class="nextline-block">
<input type="checkbox" name="update_notify"#echo ('', $checked)[$sg_var('UPDATE_NOTIFY', True)]#>
<input type="checkbox" class="views-if-interval1" name="update_notify"#echo ('', $checked)[$sg_var('UPDATE_NOTIFY', True)]#>
<p>display message for outdated software, run checks at startup and at interval<sup>1</sup></p>
</label>
<label class="nextline-block">
<input type="checkbox" name="update_auto"#echo ('', $checked)[$sg_var('UPDATE_AUTO')]#>
<input type="checkbox" class="views-if-interval1" name="update_auto"#echo ('', $checked)[$sg_var('UPDATE_AUTO')]#>
<p>update software automatically at startup and at interval<sup>1</sup></p>
</label>
<label class="nextline-block" style="padding:6px 0">
#set $hide_interval1 = not ($sg_var('UPDATE_NOTIFY') or $sg_var('UPDATE_AUTO'))
<label class="nextline-block show-if-interval1" style="#if $hide_interval1#display:none;#end if#padding:6px 0">
<input type="text" name="update_interval" value="$sg_var('UPDATE_INTERVAL', 12)" class="form-control input-sm input75">
<p>hours interval<sup>1</sup> (default:$sg_var('DEFAULT_UPDATE_INTERVAL', 'n/a'))</p>
</label>
<label class="nextline-block">
<label class="nextline-block show-if-interval1"#if $hide_interval1# style="display:none"#end if#>
<input type="checkbox" name="notify_on_update"#echo ('', $checked)[$sg_var('NOTIFY_ON_UPDATE')]#>
<p>send a message to all enabled notifiers when SickGear is updated</p>
</label>
@ -200,26 +201,30 @@
</div>
<div class="field-pair">
<div class="field-pair">
<label for="update-libs" class="nextline-block">
<span class="component-title">Package updates</span>
<span class="component-desc">
<input class="view-if" type="checkbox" name="update_packages_notify" id="update-libs"#echo ('', $checked)[$sg_var('UPDATE_PACKAGES_NOTIFY')]#>
<span class="component-title">Package updates</span>
<span class="component-desc">
<label class="nextline-block">
<input type="checkbox" class="views-if-package-table views-if-interval2" name="update_packages_notify" #echo ('', $checked)[$sg_var('UPDATE_PACKAGES_NOTIFY')]#>
<p>display message for outdated packages, run checks at startup and at interval<sup>2</sup></p>
</span>
</label>
<div class="show-if-update-libs">
<span class="component-title"></span>
<span class="component-desc">
<label class="nextline-block">
<input type="checkbox" name="update_packages_auto"#echo ('', $checked)[$sg_var('UPDATE_PACKAGES_AUTO')]#>
<p>update packages automatically at startup and at interval<sup>2</sup></p>
</label>
</label>
<label class="nextline-block" style="padding-top:6px">
<input type="text" name="update_packages_interval" value="$sg_var('UPDATE_PACKAGES_INTERVAL', 24)" class="form-control input-sm input75">
<p>hours interval<sup>2</sup> (default:$sg_var('DEFAULT_UPDATE_PACKAGES_INTERVAL', 'n/a'))</p>
</label>
<label class="nextline-block">
<input type="checkbox" class="views-if-package-table views-if-interval2" name="update_packages_auto"#echo ('', $checked)[$sg_var('UPDATE_PACKAGES_AUTO')]#>
<p>update packages automatically at startup and at interval<sup>2</sup></p>
</label>
#set $hide_interval2 = not ($sg_var('UPDATE_PACKAGES_NOTIFY') or $sg_var('UPDATE_PACKAGES_AUTO'))
<label class="nextline-block show-if-interval2" style="#if $hide_interval2#display:none;#end if#padding:6px 0">
<input type="text" name="update_packages_interval" value="$sg_var('UPDATE_PACKAGES_INTERVAL', 24)" class="form-control input-sm input75">
<p>hours interval<sup>2</sup> (default:$sg_var('DEFAULT_UPDATE_PACKAGES_INTERVAL', 'n/a'))</p>
</label>
<label class="nextline-block">
<input type="checkbox" class="views-if-package-table" name="update_packages_menu"#echo ('', $checked)[$sg_var('UPDATE_PACKAGES_MENU')]#>
<p>include in 'Check for Updates' menu action</p>
</label>
#set $hide_package_tbl = not ($sg_var('UPDATE_PACKAGES_NOTIFY') or $sg_var('UPDATE_PACKAGES_AUTO') or $sg_var('UPDATE_PACKAGES_MENU'))
<div class="show-if-package-table">
#try
#set $installed, $extra_info, $known_failed = $check_pip_env()
#except
@ -253,11 +258,12 @@
<tr class="grey-text"><td>$item.lower()</td><td class="center">failed</td><td class="info-col">$update_link</td></tr>
#set $update_link = ''
#end for
</tbody></table>
<p class="extras">the above info may help with packages that don't update internally<br>manual installation tip: <code>python -m pip install -U --user package</code></p>
</tbody>
</table>
<p class="extras">the above info may help with packages that don't update internally<br>manual installation tip: <code>python -m pip install -U --user package</code></p>
</div>
</span>
</div>
</div>
</span>
</div>
#else
<div class="field-pair">

24
gui/slick/js/config.js

@ -9,6 +9,27 @@ function toggle$(el, cond){
}
}
function viewsIf(){
var that, className, done = [], target;
$('[class*="views-if"]').each(function(){
that = this;
$.each(that.classList, function(){
if(/views-if-/i.test(this)){
className = this.replace('views-if-', '');
if (-1 === $.inArray(className, done)){
done.push(className);
target = '[class*="show-if-' + className + '"]';
if ($('[class*="views-if-' + className + '"]:checked').length){
$(target).fadeIn('fast', 'linear');
} else {
$(target).fadeOut('fast', 'linear');
}
}
}
});
});
}
$(document).ready(function () {
var enabler = $('.enabler'),
viewIf = $('input.view-if'),
@ -27,6 +48,9 @@ $(document).ready(function () {
content_id.fadeOut('fast', 'linear');
});
$('[class*="views-if"]').on({click: viewsIf});
viewsIf();
viewIf.each(function () {
$(($(this).prop('checked') ? '.hide-if-' : '.show-if-') + $(this).attr('id')).hide();
});

5
sickbeard/__init__.py

@ -141,6 +141,7 @@ MAX_UPDATE_PACKAGES_INTERVAL = 9999
DEFAULT_UPDATE_PACKAGES_INTERVAL = 24
UPDATE_PACKAGES_NOTIFY = False
UPDATE_PACKAGES_AUTO = False
UPDATE_PACKAGES_MENU = False
UPDATE_PACKAGES_INTERVAL = DEFAULT_UPDATE_PACKAGES_INTERVAL
CUR_COMMIT_HASH = None
@ -672,7 +673,7 @@ def init_stage_1(console_logging):
global LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SHOW_UPDATE_HOUR, \
TRASH_REMOVE_SHOW, TRASH_ROTATE_LOGS, ACTUAL_LOG_DIR, LOG_DIR, TVINFO_TIMEOUT, ROOT_DIRS, \
UPDATE_NOTIFY, UPDATE_AUTO, UPDATE_INTERVAL, NOTIFY_ON_UPDATE,\
UPDATE_PACKAGES_NOTIFY, UPDATE_PACKAGES_AUTO, UPDATE_PACKAGES_INTERVAL
UPDATE_PACKAGES_NOTIFY, UPDATE_PACKAGES_AUTO, UPDATE_PACKAGES_MENU, UPDATE_PACKAGES_INTERVAL
# Gen Config/Interface
global THEME_NAME, DEFAULT_HOME, FANART_LIMIT, SHOWLIST_TAGVIEW, SHOW_TAGS, \
HOME_SEARCH_FOCUS, USE_IMDB_INFO, IMDB_ACCOUNTS, DISPLAY_FREESPACE, SORT_ARTICLE, FUZZY_DATING, TRIM_ZERO, \
@ -928,6 +929,7 @@ def init_stage_1(console_logging):
UPDATE_PACKAGES_NOTIFY = bool(
check_setting_int(CFG, 'General', 'update_packages_notify', 'win' == sys.platform[0:3]))
UPDATE_PACKAGES_AUTO = bool(check_setting_int(CFG, 'General', 'update_packages_auto', 0))
UPDATE_PACKAGES_MENU = bool(check_setting_int(CFG, 'General', 'update_packages_menu', 0))
UPDATE_PACKAGES_INTERVAL = max(
MIN_UPDATE_PACKAGES_INTERVAL,
check_setting_int(CFG, 'General', 'update_packages_interval', DEFAULT_UPDATE_PACKAGES_INTERVAL))
@ -1873,6 +1875,7 @@ def save_config():
new_config['General']['notify_on_update'] = int(NOTIFY_ON_UPDATE)
new_config['General']['update_packages_notify'] = int(UPDATE_PACKAGES_NOTIFY)
new_config['General']['update_packages_auto'] = int(UPDATE_PACKAGES_AUTO)
new_config['General']['update_packages_menu'] = int(UPDATE_PACKAGES_MENU)
new_config['General']['update_packages_interval'] = int(UPDATE_PACKAGES_INTERVAL)
new_config['General']['naming_strip_year'] = int(NAMING_STRIP_YEAR)
new_config['General']['naming_pattern'] = NAMING_PATTERN

8
sickbeard/version_checker.py

@ -63,8 +63,12 @@ class PackagesUpdater(object):
:returns: True when package install/updates are available
"""
if force and not sickbeard.UPDATE_PACKAGES_MENU:
logger.log('Checking not enabled from menu action for %s' % self.install_type)
return False
if not sickbeard.UPDATE_PACKAGES_NOTIFY and not sickbeard.UPDATE_PACKAGES_AUTO and not force:
logger.log('Checking for %s is not enabled' % self.install_type)
logger.log('Checking not enabled for %s' % self.install_type)
return False
logger.log('Checking for %s%s' % (self.install_type, ('', ' (from menu)')[force]))
@ -145,7 +149,7 @@ class SoftwareUpdater(object):
"""
if not sickbeard.UPDATE_NOTIFY and not sickbeard.UPDATE_AUTO and not force:
logger.log('Checking for software updates is not enabled')
logger.log('Checking not enabled for software updates')
return False
logger.log('Checking for "%s" software update%s' % (self.install_type, ('', ' (from menu)')[force]))

4
sickbeard/webserve.py

@ -6997,7 +6997,8 @@ class ConfigGeneral(Config):
indexer_default=None, indexer_timeout=None,
show_dirs_with_dots=None,
update_notify=None, update_auto=None, update_interval=None, notify_on_update=None,
update_packages_notify=None, update_packages_auto=None, update_packages_interval=None,
update_packages_notify=None, update_packages_auto=None, update_packages_menu=None,
update_packages_interval=None,
update_frequency=None, # deprecated 2020.11.07
theme_name=None, default_home=None, fanart_limit=None, showlist_tagview=None, show_tags=None,
home_search_focus=None, use_imdb_info=None, display_freespace=None, sort_article=None,
@ -7048,6 +7049,7 @@ class ConfigGeneral(Config):
config.schedule_update_packages_notify(config.checkbox_to_value(update_packages_notify))
sickbeard.UPDATE_PACKAGES_AUTO = config.checkbox_to_value(update_packages_auto)
sickbeard.UPDATE_PACKAGES_MENU = config.checkbox_to_value(update_packages_menu)
config.schedule_update_packages(update_packages_interval)
# Interface

Loading…
Cancel
Save