1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Added a checkout branch button to the advanced config settings tab to tie things in better and make them easier.

This commit is contained in:
echel0n 2014-07-27 15:20:17 -07:00
parent ef8b4e587d
commit f4b24bd85d
4 changed files with 43 additions and 32 deletions

View File

@ -71,6 +71,7 @@ throwaway = datetime.datetime.strptime('20110101', '%Y%m%d')
signal.signal(signal.SIGINT, sickbeard.sig_handler)
signal.signal(signal.SIGTERM, sickbeard.sig_handler)
class SickRage(object):
def __init__(self):
# system event callback for shutdown/restart
@ -455,7 +456,8 @@ class SickRage(object):
sickbeard.showList.append(curShow)
except Exception, e:
logger.log(
u"There was an error creating the show in " + sqlShow["location"] + ": " + str(e).decode('utf-8', 'replace'),
u"There was an error creating the show in " + sqlShow["location"] + ": " + str(e).decode('utf-8',
'replace'),
logger.ERROR)
def restore(self, srcDir, dstDir):
@ -519,6 +521,7 @@ class SickRage(object):
# system exit
os._exit(0)
if __name__ == "__main__":
if sys.hexversion >= 0x020600F0:
freeze_support()

View File

@ -278,13 +278,14 @@
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Git Branch:</span>
<span class="component-title">Branch Version:</span>
<span class="component-desc">
<select id="git_branch" name="git_branch">
<select id="branchVersion" name="branchVersion">
#for $cur_branch in $sickbeard.versionCheckScheduler.action.list_remote_branches():
<option value="$cur_branch" #if $cur_branch == $sickbeard.version.SICKBEARD_VERSION then "selected=\"selected\"" else ""#>$cur_branch.capitalize()</option>
#end for
</select>
<input class="btn" class="btn" type="button" id="branchCheckout" value="Checkout Branch">
</span>
</label>
<label class="nocheck clearfix">

View File

@ -1,27 +1,27 @@
$(document).ready(function(){
$(".enabler").each(function(){
$(document).ready(function () {
$(".enabler").each(function () {
if (!$(this).prop('checked'))
$('#content_'+$(this).attr('id')).hide();
$('#content_' + $(this).attr('id')).hide();
});
$(".enabler").click(function() {
$(".enabler").click(function () {
if ($(this).prop('checked'))
$('#content_'+$(this).attr('id')).fadeIn("fast", "linear");
$('#content_' + $(this).attr('id')).fadeIn("fast", "linear");
else
$('#content_'+$(this).attr('id')).fadeOut("fast", "linear");
$('#content_' + $(this).attr('id')).fadeOut("fast", "linear");
});
$(".viewIf").click(function() {
$(".viewIf").click(function () {
if ($(this).prop('checked')) {
$('.hide_if_'+$(this).attr('id')).css('display','none');
$('.show_if_'+$(this).attr('id')).fadeIn("fast", "linear");
$('.hide_if_' + $(this).attr('id')).css('display', 'none');
$('.show_if_' + $(this).attr('id')).fadeIn("fast", "linear");
} else {
$('.show_if_'+$(this).attr('id')).css('display','none');
$('.hide_if_'+$(this).attr('id')).fadeIn("fast", "linear");
$('.show_if_' + $(this).attr('id')).css('display', 'none');
$('.hide_if_' + $(this).attr('id')).fadeIn("fast", "linear");
}
});
$(".datePresets").click(function() {
$(".datePresets").click(function () {
var def = $('#date_presets').val()
if ($(this).prop('checked') && '%x' == def) {
def = '%a, %b %d, %Y'
@ -44,34 +44,44 @@ $(document).ready(function(){
// bind 'myForm' and provide a simple callback function
$('#configForm').ajaxForm({
beforeSubmit: function(){
$('.config_submitter').each(function(){
beforeSubmit: function () {
$('.config_submitter').each(function () {
$(this).attr("disabled", "disabled");
$(this).after('<span><img src="'+sbRoot+'/images/loading16.gif"> Saving...</span>');
$(this).after('<span><img src="' + sbRoot + '/images/loading16.gif"> Saving...</span>');
$(this).hide();
});
},
success: function(){
success: function () {
setTimeout('config_success()', 2000)
}
});
$('#api_key').click(function(){ $('#api_key').select() });
$("#generate_new_apikey").click(function(){
$.get(sbRoot + '/config/general/generateKey',
function(data){
$('#api_key').click(function () {
$('#api_key').select()
});
$("#generate_new_apikey").click(function () {
$.get(sbRoot + '/config/general/generateKey',
function (data) {
if (data.error != undefined) {
alert(data.error);
return;
}
$('#api_key').val(data);
});
});
});
$('#branchCheckout').click(function () {
$("#branchCheckout").attr("disabled", true);
var branchVersion = $("#branchVersion").val();
$.get(sbRoot + "/home/update", {'pid': sbPID, 'branch': branchVersion})
.done(function () {
$("#branchCheckout").attr("disabled", false);
});
});
});
function config_success(){
$('.config_submitter').each(function(){
function config_success() {
$('.config_submitter').each(function () {
$(this).removeAttr("disabled");
$(this).next().remove();
$(this).show();

View File

@ -1436,7 +1436,7 @@ class ConfigGeneral(MainHandler):
handle_reverse_proxy=None, sort_article=None, auto_update=None, notify_on_update=None,
proxy_setting=None, anon_redirect=None, git_path=None, calendar_unprotected=None,
fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None,
indexer_timeout=None, play_videos=None, git_branch=None):
indexer_timeout=None, play_videos=None):
results = []
@ -1503,11 +1503,8 @@ class ConfigGeneral(MainHandler):
sickbeard.HANDLE_REVERSE_PROXY = config.checkbox_to_value(handle_reverse_proxy)
sickbeard.save_config()
sickbeard.versionCheckScheduler.action.update(git_branch)
if len(results) > 0:
for x in results:
logger.log(x, logger.ERROR)
@ -3455,12 +3452,12 @@ class Home(MainHandler):
return _munge(t)
def update(self, pid=None):
def update(self, pid=None, branch=None):
if str(pid) != str(sickbeard.PID):
redirect("/home/")
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable
updated = sickbeard.versionCheckScheduler.action.update(branch) # @UndefinedVariable
if updated:
# do a hard restart
sickbeard.events.put(sickbeard.events.SystemEvent.RESTART)