1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04: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.SIGINT, sickbeard.sig_handler)
signal.signal(signal.SIGTERM, sickbeard.sig_handler) signal.signal(signal.SIGTERM, sickbeard.sig_handler)
class SickRage(object): class SickRage(object):
def __init__(self): def __init__(self):
# system event callback for shutdown/restart # system event callback for shutdown/restart
@ -455,7 +456,8 @@ class SickRage(object):
sickbeard.showList.append(curShow) sickbeard.showList.append(curShow)
except Exception, e: except Exception, e:
logger.log( 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) logger.ERROR)
def restore(self, srcDir, dstDir): def restore(self, srcDir, dstDir):
@ -519,6 +521,7 @@ class SickRage(object):
# system exit # system exit
os._exit(0) os._exit(0)
if __name__ == "__main__": if __name__ == "__main__":
if sys.hexversion >= 0x020600F0: if sys.hexversion >= 0x020600F0:
freeze_support() freeze_support()

View File

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

View File

@ -1,27 +1,27 @@
$(document).ready(function(){ $(document).ready(function () {
$(".enabler").each(function(){ $(".enabler").each(function () {
if (!$(this).prop('checked')) if (!$(this).prop('checked'))
$('#content_'+$(this).attr('id')).hide(); $('#content_' + $(this).attr('id')).hide();
}); });
$(".enabler").click(function() { $(".enabler").click(function () {
if ($(this).prop('checked')) if ($(this).prop('checked'))
$('#content_'+$(this).attr('id')).fadeIn("fast", "linear"); $('#content_' + $(this).attr('id')).fadeIn("fast", "linear");
else 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')) { if ($(this).prop('checked')) {
$('.hide_if_'+$(this).attr('id')).css('display','none'); $('.hide_if_' + $(this).attr('id')).css('display', 'none');
$('.show_if_'+$(this).attr('id')).fadeIn("fast", "linear"); $('.show_if_' + $(this).attr('id')).fadeIn("fast", "linear");
} else { } else {
$('.show_if_'+$(this).attr('id')).css('display','none'); $('.show_if_' + $(this).attr('id')).css('display', 'none');
$('.hide_if_'+$(this).attr('id')).fadeIn("fast", "linear"); $('.hide_if_' + $(this).attr('id')).fadeIn("fast", "linear");
} }
}); });
$(".datePresets").click(function() { $(".datePresets").click(function () {
var def = $('#date_presets').val() var def = $('#date_presets').val()
if ($(this).prop('checked') && '%x' == def) { if ($(this).prop('checked') && '%x' == def) {
def = '%a, %b %d, %Y' def = '%a, %b %d, %Y'
@ -44,34 +44,44 @@ $(document).ready(function(){
// bind 'myForm' and provide a simple callback function // bind 'myForm' and provide a simple callback function
$('#configForm').ajaxForm({ $('#configForm').ajaxForm({
beforeSubmit: function(){ beforeSubmit: function () {
$('.config_submitter').each(function(){ $('.config_submitter').each(function () {
$(this).attr("disabled", "disabled"); $(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(); $(this).hide();
}); });
}, },
success: function(){ success: function () {
setTimeout('config_success()', 2000) setTimeout('config_success()', 2000)
} }
}); });
$('#api_key').click(function(){ $('#api_key').select() }); $('#api_key').click(function () {
$("#generate_new_apikey").click(function(){ $('#api_key').select()
$.get(sbRoot + '/config/general/generateKey', });
function(data){ $("#generate_new_apikey").click(function () {
$.get(sbRoot + '/config/general/generateKey',
function (data) {
if (data.error != undefined) { if (data.error != undefined) {
alert(data.error); alert(data.error);
return; return;
} }
$('#api_key').val(data); $('#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(){ function config_success() {
$('.config_submitter').each(function(){ $('.config_submitter').each(function () {
$(this).removeAttr("disabled"); $(this).removeAttr("disabled");
$(this).next().remove(); $(this).next().remove();
$(this).show(); $(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, 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, 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, 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 = [] results = []
@ -1503,11 +1503,8 @@ class ConfigGeneral(MainHandler):
sickbeard.HANDLE_REVERSE_PROXY = config.checkbox_to_value(handle_reverse_proxy) sickbeard.HANDLE_REVERSE_PROXY = config.checkbox_to_value(handle_reverse_proxy)
sickbeard.save_config() sickbeard.save_config()
sickbeard.versionCheckScheduler.action.update(git_branch)
if len(results) > 0: if len(results) > 0:
for x in results: for x in results:
logger.log(x, logger.ERROR) logger.log(x, logger.ERROR)
@ -3455,12 +3452,12 @@ class Home(MainHandler):
return _munge(t) return _munge(t)
def update(self, pid=None): def update(self, pid=None, branch=None):
if str(pid) != str(sickbeard.PID): if str(pid) != str(sickbeard.PID):
redirect("/home/") redirect("/home/")
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable updated = sickbeard.versionCheckScheduler.action.update(branch) # @UndefinedVariable
if updated: if updated:
# do a hard restart # do a hard restart
sickbeard.events.put(sickbeard.events.SystemEvent.RESTART) sickbeard.events.put(sickbeard.events.SystemEvent.RESTART)