forked from hummypkg/sweeper
beta 2.1.4
This commit is contained in:
parent
44bcd90b9f
commit
4aec6d3679
@ -1,9 +1,9 @@
|
||||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.1.3-1
|
||||
Version: 2.1.4
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.3.0-1)
|
||||
Depends: webif(>=1.3.4)
|
||||
Description: Sweeper is a package for managing recordings in a variety of ways using custom rules [See forum for details]
|
||||
Tags: http://hummy.tv/forum/threads/5138/
|
||||
|
@ -890,6 +890,26 @@ proc ::sweeper::action_unflag {ts cmd arg folder} {
|
||||
return 0
|
||||
}
|
||||
|
||||
proc ::sweeper::action_queue {ts cmd arg folder} {
|
||||
log "Queued [$ts get file] for $arg" 0
|
||||
if {!$::sweeper::dryrun} {
|
||||
queue insert $ts $arg
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
proc ::sweeper::action_dequeue {ts cmd arg folder} {
|
||||
log "De-queued [$ts get file] for $arg" 0
|
||||
if {!$::sweeper::dryrun} {
|
||||
if {$arg eq "all"} {
|
||||
queue delete $ts
|
||||
} else {
|
||||
queue delete $ts $arg
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
eval_plugins sweeper
|
||||
|
||||
######################################################################
|
||||
|
@ -235,6 +235,8 @@ For pattern matching, the following special sequences may appear in the pattern:
|
||||
<div class=hidden id=edit_action title="Rule Action">
|
||||
<select name=edit_action_act id=edit_action_act></select>
|
||||
<input name=edit_action_arg id=edit_action_arg size=60 maxlength=255 />
|
||||
<select class=hidden name=edit_action_select_field
|
||||
id=edit_action_select_field></select>
|
||||
<div class="hidden edit_action_help blood" id=edit_action_help_folder>
|
||||
Enter one of:
|
||||
<ul>
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require lock system.class ts.class pretty_size browse.class \
|
||||
safe_delete settings.class plugin
|
||||
safe_delete settings.class plugin queue.class
|
||||
|
||||
proc log {msg {level 1}} {
|
||||
puts "[\
|
||||
|
@ -324,14 +324,59 @@ var schema = {
|
||||
},
|
||||
flag: {
|
||||
'class': 'all',
|
||||
argtype: 'string',
|
||||
argtype: 'select',
|
||||
desc: 'Set recording flag...',
|
||||
select: {
|
||||
Locked: 'Locked',
|
||||
New: 'New',
|
||||
Encrypted: 'Encrypted',
|
||||
Guidance: 'Guidance',
|
||||
ODEncrypted: 'Encrypted On-Disk',
|
||||
Shrunk: 'Shrunk',
|
||||
Deduped: 'De-duplicated',
|
||||
Radio: 'Radio Programme'
|
||||
},
|
||||
continues: true
|
||||
},
|
||||
unflag: {
|
||||
'class': 'all',
|
||||
argtype: 'string',
|
||||
argtype: 'select',
|
||||
desc: 'Unset recording flag...',
|
||||
select: {
|
||||
Locked: 'Locked',
|
||||
New: 'New',
|
||||
Encrypted: 'Encrypted',
|
||||
Guidance: 'Guidance',
|
||||
ODEncrypted: 'Encrypted On-Disk',
|
||||
Shrunk: 'Shrunk',
|
||||
Deduped: 'De-duplicated',
|
||||
Radio: 'Radio Programme'
|
||||
},
|
||||
continues: true
|
||||
},
|
||||
queue: {
|
||||
'class': 'all',
|
||||
argtype: 'select',
|
||||
desc: 'Queue recording for',
|
||||
select: {
|
||||
decrypt: 'Decryption',
|
||||
shrink: 'Shrink',
|
||||
mp3: 'Audio Extraction',
|
||||
mpg: 'Conversion to MPG'
|
||||
},
|
||||
continues: true
|
||||
},
|
||||
dequeue: {
|
||||
'class': 'all',
|
||||
argtype: 'select',
|
||||
desc: 'De-queue recording for',
|
||||
select: {
|
||||
all: '-- Everything --',
|
||||
decrypt: 'Decryption',
|
||||
shrink: 'Shrink',
|
||||
mp3: 'Audio Extraction',
|
||||
mpg: 'Conversion to MPG'
|
||||
},
|
||||
continues: true
|
||||
},
|
||||
'delete': {
|
||||
|
@ -160,10 +160,20 @@ function ruleconf(rule)
|
||||
arg = '';
|
||||
if (act != 'continue')
|
||||
{
|
||||
if (schema.action[act].argtype == 'none')
|
||||
switch (schema.action[act].argtype)
|
||||
{
|
||||
case 'none':
|
||||
s += 'action ' + act;
|
||||
else
|
||||
break;
|
||||
case 'select':
|
||||
arg = $.trim(
|
||||
rule.find('tr.action td.val').attr('val'));
|
||||
s += 'action {' + act + ' ' + quot(arg) + '}';
|
||||
break;
|
||||
default:
|
||||
s += 'action {' + act + ' ' + quot(arg) + '}';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -304,8 +314,13 @@ function action(data)
|
||||
|
||||
s = '<tr class=action>' +
|
||||
'<th class=title>Then:</th>' +
|
||||
'<th class=cmd cmd=' + data.cmd + '>' + c.desc + '</th>' +
|
||||
'<td class=val>' + data.arg + '</td>' +
|
||||
'<th class=cmd cmd=' + data.cmd + '>' + c.desc + '</th>';
|
||||
if (c.argtype == 'select')
|
||||
s += '<td class=val val=\"' + data.arg + '\">' +
|
||||
c.select[data.arg];
|
||||
else
|
||||
s += '<td class=val>' + data.arg;
|
||||
s += '</td>' +
|
||||
'<td><a class=editaction href=#>' +
|
||||
'<img src=img/edit.png></a></td>' +
|
||||
'</tr>';
|
||||
@ -1127,23 +1142,22 @@ $('#ruleset')
|
||||
|
||||
var cmd = rule.find('tr.action th.cmd').attr('cmd');
|
||||
var arg = rule.find('tr.action td.val').html();
|
||||
|
||||
if (schema.action[cmd].argtype == 'none')
|
||||
{
|
||||
arg = '';
|
||||
$('#edit_action_arg').disable();
|
||||
}
|
||||
else
|
||||
$('#edit_action_arg').enable();
|
||||
|
||||
$('.edit_action_help').hide();
|
||||
$('#edit_action_help_' + schema.action[cmd].argtype).show();
|
||||
|
||||
if (schema.action[cmd].argtype == 'folder' && arg == mroot)
|
||||
arg = '';
|
||||
|
||||
$('#edit_action_act').val(cmd);
|
||||
$('#edit_action_arg').val(arg);
|
||||
$('#edit_action_act').val(cmd).trigger('change');
|
||||
if (schema.action[cmd].argtype == 'select')
|
||||
{
|
||||
$('#edit_action_select_field').val(arg);
|
||||
$.each(schema.action[cmd].select, function(k, v) {
|
||||
if (arg == v)
|
||||
$('#edit_action_select_field').val(k);
|
||||
});
|
||||
}
|
||||
else
|
||||
$('#edit_action_arg').val(arg);
|
||||
|
||||
$('#edit_action').dialog({
|
||||
height: 'auto', width: 'auto',
|
||||
@ -1158,7 +1172,11 @@ $('#ruleset')
|
||||
buttons: {
|
||||
"Save": function() {
|
||||
cmd = $('#edit_action_act').val();
|
||||
arg = $('#edit_action_arg').val();
|
||||
if (schema.action[cmd].argtype == 'select')
|
||||
arg = $('#edit_action_select_field')
|
||||
.val();
|
||||
else
|
||||
arg = $('#edit_action_arg').val();
|
||||
|
||||
rule.find('table.action tbody').empty()
|
||||
.append(action({cmd: cmd, arg: arg}));
|
||||
@ -1235,6 +1253,31 @@ $('#ruleset')
|
||||
|
||||
$('#edit_action_act').on('change', function(e) {
|
||||
var cmd = $(this).val();
|
||||
|
||||
$('#edit_action_arg').show();
|
||||
$('#edit_action_select_field').hide();
|
||||
switch (schema.action[cmd].argtype)
|
||||
{
|
||||
case 'none':
|
||||
$('#edit_action_arg').disable();
|
||||
break;
|
||||
case 'select':
|
||||
$('#edit_action_arg').hide();
|
||||
$('#edit_action_select_field').empty().show();
|
||||
$.each(schema.action[cmd].select, function(k, v) {
|
||||
$('#edit_action_select_field').append(
|
||||
$('<option></option>')
|
||||
.attr('value', k).text(v)
|
||||
);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
$('#edit_action_arg').enable();
|
||||
break;
|
||||
}
|
||||
|
||||
$('.edit_action_help').hide();
|
||||
$('#edit_action_help_' + schema.action[cmd].argtype).show();
|
||||
if (schema.action[cmd].argtype == 'none')
|
||||
$('#edit_action_arg').disable();
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user