Browse Source

Extended API to allow setting cat/pp/script for multiple nzbs at same time, comma-delimited. Change implementation to behave more like set_priority_multiple()? Plush Multi-Operations now fully working.

tags/0.6.0
pairofdimes 15 years ago
parent
commit
e154a58bd6
  1. 5
      SABnzbd.py
  2. 21
      interfaces/Plush/templates/static/javascripts/plush.js
  3. 38
      sabnzbd/interface.py
  4. 5
      sabnzbd/nzbstuff.py

5
SABnzbd.py

@ -1012,7 +1012,10 @@ def main():
xlist= globber(logdir)
for x in xlist:
if RSS_FILE_NAME not in x:
os.remove(x)
try:
os.remove(x)
except:
pass
log_new = sabnzbd.cfg.log_new()
if log_new:

21
interfaces/Plush/templates/static/javascripts/plush.js

@ -562,9 +562,17 @@ jQuery(function($){
});
}); // end livequery
$.plush.InitQueueMultiOperations();
}, // end $.plush.InitQueue()
// Multi-Operations
// ***************************************************************
// $.plush.InitQueueMultiOperations() - Queue Multi-Operation Events
InitQueueMultiOperations : function() {
// selections
$("#multiops_select_all").click(function(){
$("INPUT[type='checkbox']","#queueTable").attr('checked', true);
@ -594,11 +602,13 @@ jQuery(function($){
e.target.unselectable = "on";
e.target.style.MozUserSelect = "none";
});
// reset ui options
$('#multi_reset').click(function(){
$('#multi_status, #multi_cat, #multi_priority, #multi_pp, #multi_script').val('');
});
// apply options - cat/priority/pp/script
$('#multi_apply').click(function(){
var nzo_ids = "";
@ -628,7 +638,7 @@ jQuery(function($){
$.ajax({
type: "POST",
url: "tapi",
data: {mode: 'proc_priority', value: nzo_ids, value2: $('#multi_priority').val(), apikey: $.plush.apikey}
data: {mode:'queue', name:'priority', value: nzo_ids, value2: $('#multi_priority').val(), apikey: $.plush.apikey}
});
if ($('#multi_pp').val())
@ -649,6 +659,7 @@ jQuery(function($){
$.plush.RefreshQueue();
});
// nzb removal
$('#multi_delete').click(function(){
var nzo_ids = "";
@ -668,8 +679,8 @@ jQuery(function($){
}
});
}, // end $.plush.InitQueue()
}, // end $.plush.InitQueueMultiOperations()
// ***************************************************************
// $.plush.InitHistory() -- History Events

38
sabnzbd/interface.py

@ -718,34 +718,54 @@ class MainPage:
if mode == 'change_cat':
if value and value2:
nzo_id = value
cat = value2
if cat == 'None':
cat = None
nzbqueue.change_cat(nzo_id, cat)
cat, pp, script, cat_priority = cat_to_opts(cat)
items = value.split(',')
if len(items) > 1:
for nzo_id in items:
nzbqueue.change_cat(nzo_id, cat)
cat, pp, script, cat_priority = cat_to_opts(cat)
nzbqueue.change_script(nzo_id, script)
nzbqueue.change_opts(nzo_id, pp)
nzbqueue.set_priority(nzo_id, cat_priority)
else:
nzo_id = value
nzbqueue.change_cat(nzo_id, cat)
cat, pp, script, cat_priority = cat_to_opts(cat)
nzbqueue.change_script(nzo_id, script)
nzbqueue.change_opts(nzo_id, pp)
nzbqueue.set_priority(nzo_id, cat_priority)
nzbqueue.change_script(nzo_id, script)
nzbqueue.change_opts(nzo_id, pp)
nzbqueue.set_priority(nzo_id, cat_priority)
return report(output)
else:
return report(output, _MSG_NO_VALUE)
if mode == 'change_script':
if value and value2:
nzo_id = value
script = value2
if script.lower() == 'none':
script = None
nzbqueue.change_script(nzo_id, script)
items = value.split(',')
if len(items) > 1:
for nzo_id in items:
nzbqueue.change_script(nzo_id, script)
else:
nzo_id = value
nzbqueue.change_script(nzo_id, script)
return report(output)
else:
return report(output, _MSG_NO_VALUE)
if mode == 'change_opts':
if value and value2 and value2.isdigit():
nzbqueue.change_opts(value, int(value2))
items = value.split(',')
if len(items) > 1:
for nzo_id in items:
nzbqueue.change_opts(nzo_id, int(value2))
else:
nzbqueue.change_opts(value, int(value2))
return report(output)
if mode == 'fullstatus':

5
sabnzbd/nzbstuff.py

@ -676,6 +676,10 @@ class NzbObject(TryList):
else:
accept = 1
# Re-evaluate results from pre-queue script
self.cat, pp, self.script, self.priority = cat_to_opts(cat, pp, script, self.priority)
self.repair, self.unpack, self.delete = sabnzbd.pp_to_opts(pp)
# Pause job when above size limit
if accept > 1:
limit = 1
@ -686,7 +690,6 @@ class NzbObject(TryList):
self.pause()
self.priority = LOW_PRIORITY
self.repair, self.unpack, self.delete = sabnzbd.pp_to_opts(pp)
if reuse:
self.check_existing_files(wdir)

Loading…
Cancel
Save