add bookmarks condition + plugin framework
This commit is contained in:
parent
2460cda298
commit
b90690c808
|
@ -1,7 +1,7 @@
|
|||
Package: sweeper
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 2.0.8-6
|
||||
Version: 2.0.9
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif(>=1.2.3-2)
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
var select_file_criteria = {};
|
||||
var select_folder_criteria = {};
|
||||
var select_global_criteria = {};
|
||||
$.each(schema.criterion, function(k, v) {
|
||||
if (v.deprecated)
|
||||
return;
|
||||
switch (v['class'])
|
||||
{
|
||||
case 'file':
|
||||
select_file_criteria[k] = v.desc;
|
||||
break;
|
||||
case 'folder':
|
||||
select_folder_criteria[k] = v.desc;
|
||||
break;
|
||||
case 'global':
|
||||
select_global_criteria[k] = v.desc;
|
||||
break;
|
||||
case 'all':
|
||||
select_file_criteria[k] = v.desc;
|
||||
select_folder_criteria[k] = v.desc;
|
||||
select_global_criteria[k] = v.desc;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
var select_file_actions = {};
|
||||
var select_folder_actions = {};
|
||||
var select_global_actions = {};
|
||||
$.each(schema.action, function(k, v) {
|
||||
if (v.deprecated)
|
||||
return;
|
||||
switch (v['class'])
|
||||
{
|
||||
case 'file':
|
||||
select_file_actions[k] = v.desc;
|
||||
break;
|
||||
case 'folder':
|
||||
select_folder_actions[k] = v.desc;
|
||||
break;
|
||||
case 'global':
|
||||
select_global_actions[k] = v.desc;
|
||||
break;
|
||||
case 'all':
|
||||
select_file_actions[k] = v.desc;
|
||||
select_folder_actions[k] = v.desc;
|
||||
select_global_actions[k] = v.desc;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
@ -382,6 +382,10 @@ proc ::sweeper::wage {ts age folder} {
|
|||
return [::sweeper::intcomp $recage $age]
|
||||
}
|
||||
|
||||
proc ::sweeper::bookmarks {ts bookmarks folder} {
|
||||
return [::sweeper::intcomp [$ts get bookmarks] $bookmarks]
|
||||
}
|
||||
|
||||
proc ::sweeper::definition {ts def folder} {
|
||||
return [::sweeper::strcontains [$ts get definition] $def]
|
||||
}
|
||||
|
@ -675,6 +679,8 @@ proc ::sweeper::action_delete {ts cmd arg folder} {
|
|||
return 1
|
||||
}
|
||||
|
||||
eval_plugins sweeper
|
||||
|
||||
######################################################################
|
||||
# Handle action
|
||||
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require system.class
|
||||
require system.class plugin
|
||||
|
||||
set dir [cgi_get dir ""]
|
||||
set root [system mediaroot]
|
||||
|
||||
if {$dir eq ""} { set dir $root }
|
||||
|
||||
jscss {schema.js config.jim script.js} style.css
|
||||
jscss {schema.js macro.js config.jim} style.css
|
||||
eval_plugins sweeperjs
|
||||
jscss {action.js script.js}
|
||||
jqplugin confirmAction enadis
|
||||
header
|
||||
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
|
||||
var macros = {
|
||||
seriesfiler: {
|
||||
desc: 'Series-Filer',
|
||||
rules: [
|
||||
{
|
||||
"raw": "action {fileunder ""}",
|
||||
"name": "Emulate Seriesfiler",
|
||||
"type": "folder",
|
||||
"enabled": "1",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "series",
|
||||
"arg": ""
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "fileunder",
|
||||
"arg": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
newk: {
|
||||
desc: 'Remove New: prefix',
|
||||
rules: [
|
||||
{
|
||||
"raw": "title New:* action {settitle {%orig%regsub,New:\\s*,,}}",
|
||||
"name": "Remove New: prefix.",
|
||||
"type": "global",
|
||||
"enabled": "1",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "title",
|
||||
"arg": "New:*"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "settitle",
|
||||
"arg": "%orig%regsub,New:\\s*,,"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
example: {
|
||||
desc: 'Example rules',
|
||||
rules: [
|
||||
{
|
||||
"raw": "lcn {>= 70} lcn {<= 79} or {duration {>= 90} genre Film } action {move Children/Films}",
|
||||
"name": "Move any Children's films",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "lcn",
|
||||
"arg": ">= 70"
|
||||
},
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "lcn",
|
||||
"arg": "<= 79"
|
||||
},
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "or",
|
||||
"arg": "duration {>= 90} genre Film ",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "duration",
|
||||
"arg": ">= 90"
|
||||
},
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "genre",
|
||||
"arg": "Film"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "move",
|
||||
"arg": "Children/Films"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "lcn {>= 70} lcn {<= 79} action {move Children/Miscellaneous}",
|
||||
"name": "Move anything else recorded from a children's channel",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": ">= 70"
|
||||
},
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": "<= 79"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "move",
|
||||
"arg": "Children/Miscellaneous"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "lcn {>= 70} lcn {<= 79} action {fileundercreate Children}",
|
||||
"name": "Move any series recordings from a Children's channel (folder rule)",
|
||||
"type": "folder",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": ">= 70"
|
||||
},
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": "<= 79"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "fileundercreate",
|
||||
"arg": "Children"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "title {Formula 1} action {move F1}",
|
||||
"name": "Move any one-off Formula 1 recordings into the F1 folder",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "title",
|
||||
"arg": "Formula 1"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "move",
|
||||
"arg": "F1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "age {> 120} action {movecreate Misc}",
|
||||
"name": "Move any one-off recordings into a folder called Misc after a while",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "age",
|
||||
"arg": "> 120"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "movecreate",
|
||||
"arg": "Misc"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
var schema = {
|
||||
criterion: {
|
||||
lcn: {
|
||||
|
@ -49,6 +50,13 @@ var schema = {
|
|||
negate: true,
|
||||
def: "0"
|
||||
},
|
||||
bookmarks: {
|
||||
'class': 'all',
|
||||
type: 'int',
|
||||
desc: 'Number of bookmarks',
|
||||
negate: true,
|
||||
def: "0"
|
||||
},
|
||||
now: {
|
||||
'class': 'all',
|
||||
type: 'int',
|
||||
|
@ -284,217 +292,3 @@ var schema = {
|
|||
}
|
||||
};
|
||||
|
||||
var macros = {
|
||||
seriesfiler: {
|
||||
desc: 'Series-Filer',
|
||||
rules: [
|
||||
{
|
||||
"raw": "action {fileunder ""}",
|
||||
"name": "Emulate Seriesfiler",
|
||||
"type": "folder",
|
||||
"enabled": "1",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "series",
|
||||
"arg": ""
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "fileunder",
|
||||
"arg": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
newk: {
|
||||
desc: 'Remove New: prefix',
|
||||
rules: [
|
||||
{
|
||||
"raw": "title New:* action {settitle {%orig%regsub,New:\\s*,,}}",
|
||||
"name": "Remove New: prefix.",
|
||||
"type": "global",
|
||||
"enabled": "1",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "title",
|
||||
"arg": "New:*"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "settitle",
|
||||
"arg": "%orig%regsub,New:\\s*,,"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
example: {
|
||||
desc: 'Example rules',
|
||||
rules: [
|
||||
{
|
||||
"raw": "lcn {>= 70} lcn {<= 79} or {duration {>= 90} genre Film } action {move Children/Films}",
|
||||
"name": "Move any Children's films",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "lcn",
|
||||
"arg": ">= 70"
|
||||
},
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "lcn",
|
||||
"arg": "<= 79"
|
||||
},
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "or",
|
||||
"arg": "duration {>= 90} genre Film ",
|
||||
"criteria": [
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "duration",
|
||||
"arg": ">= 90"
|
||||
},
|
||||
{
|
||||
"negate": 0,
|
||||
"cmd": "genre",
|
||||
"arg": "Film"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "move",
|
||||
"arg": "Children/Films"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "lcn {>= 70} lcn {<= 79} action {move Children/Miscellaneous}",
|
||||
"name": "Move anything else recorded from a children's channel",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": ">= 70"
|
||||
},
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": "<= 79"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "move",
|
||||
"arg": "Children/Miscellaneous"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "lcn {>= 70} lcn {<= 79} action {fileundercreate Children}",
|
||||
"name": "Move any series recordings from a Children's channel (folder rule)",
|
||||
"type": "folder",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": ">= 70"
|
||||
},
|
||||
{
|
||||
"cmd": "lcn",
|
||||
"arg": "<= 79"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "fileundercreate",
|
||||
"arg": "Children"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "title {Formula 1} action {move F1}",
|
||||
"name": "Move any one-off Formula 1 recordings into the F1 folder",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "title",
|
||||
"arg": "Formula 1"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "move",
|
||||
"arg": "F1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw": "age {> 120} action {movecreate Misc}",
|
||||
"name": "Move any one-off recordings into a folder called Misc after a while",
|
||||
"type": "file",
|
||||
"enabled": "0",
|
||||
"criteria": [
|
||||
{
|
||||
"cmd": "age",
|
||||
"arg": "> 120"
|
||||
}
|
||||
],
|
||||
"action": {
|
||||
"cmd": "movecreate",
|
||||
"arg": "Misc"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var select_file_criteria = {};
|
||||
var select_folder_criteria = {};
|
||||
var select_global_criteria = {};
|
||||
$.each(schema.criterion, function(k, v) {
|
||||
if (v.deprecated)
|
||||
return;
|
||||
switch (v['class'])
|
||||
{
|
||||
case 'file':
|
||||
select_file_criteria[k] = v.desc;
|
||||
break;
|
||||
case 'folder':
|
||||
select_folder_criteria[k] = v.desc;
|
||||
break;
|
||||
case 'global':
|
||||
select_global_criteria[k] = v.desc;
|
||||
break;
|
||||
case 'all':
|
||||
select_file_criteria[k] = v.desc;
|
||||
select_folder_criteria[k] = v.desc;
|
||||
select_global_criteria[k] = v.desc;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
var select_file_actions = {};
|
||||
var select_folder_actions = {};
|
||||
var select_global_actions = {};
|
||||
$.each(schema.action, function(k, v) {
|
||||
if (v.deprecated)
|
||||
return;
|
||||
switch (v['class'])
|
||||
{
|
||||
case 'file':
|
||||
select_file_actions[k] = v.desc;
|
||||
break;
|
||||
case 'folder':
|
||||
select_folder_actions[k] = v.desc;
|
||||
break;
|
||||
case 'global':
|
||||
select_global_actions[k] = v.desc;
|
||||
break;
|
||||
case 'all':
|
||||
select_file_actions[k] = v.desc;
|
||||
select_folder_actions[k] = v.desc;
|
||||
select_global_actions[k] = v.desc;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue