508 lines
9.5 KiB
JavaScript
508 lines
9.5 KiB
JavaScript
var schema = {
|
|
criterion: {
|
|
lcn: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Logical Channel Number',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
duration: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Recording duration (in minutes)',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
schedduration: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Scheduled duration (in minutes)',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
size: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Recording size (in bytes)',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
hour: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Hour in which the recording started',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
age: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Age (in hours)',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
wage: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Time since last watched, or recorded (in hours)',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
now: {
|
|
'class': 'all',
|
|
type: 'int',
|
|
desc: 'Current time in 24-hour format (HHMM)',
|
|
negate: true,
|
|
def: "0"
|
|
},
|
|
title: {
|
|
'class': 'all',
|
|
type: 'substr',
|
|
desc: 'Recording Title contains',
|
|
idesc: 'Recording Title does not contain',
|
|
negate: true,
|
|
def: 'Enter text here...'
|
|
},
|
|
synopsis: {
|
|
'class': 'all',
|
|
type: 'substr',
|
|
desc: 'Synopsis contains',
|
|
idesc: 'Synopsis does not contain',
|
|
negate: true,
|
|
def: 'Enter text here...'
|
|
},
|
|
guidance: {
|
|
'class': 'all',
|
|
type: 'substr',
|
|
desc: 'Guidance Text contains',
|
|
idesc: 'Guidance Text does not contain',
|
|
negate: true,
|
|
def: 'Enter text here...'
|
|
},
|
|
genre: {
|
|
'class': 'all',
|
|
type: 'select',
|
|
desc: 'Recording Genre',
|
|
negate: true,
|
|
select: {
|
|
Unclassified: 'Unclassified',
|
|
Film: 'Film',
|
|
Children: 'Children',
|
|
'News & Factual': 'News & Factual',
|
|
Entertainment: 'Entertainment',
|
|
Sport: 'Sport',
|
|
Education: 'Education',
|
|
Lifestyle: 'Lifestyle',
|
|
Drama: 'Drama'
|
|
},
|
|
def: 'Unclassified'
|
|
},
|
|
definition: {
|
|
'class': 'all',
|
|
type: 'select',
|
|
desc: 'Recording Definition',
|
|
negate: true,
|
|
select: {
|
|
SD: 'Standard Definition',
|
|
HD: 'High Definition'
|
|
},
|
|
def: 'SD'
|
|
},
|
|
flag: {
|
|
'class': 'all',
|
|
type: 'select',
|
|
desc: 'Recording Flagged as',
|
|
idesc: 'Recording not Flagged as',
|
|
negate: true,
|
|
select: {
|
|
Locked: 'Locked',
|
|
New: 'New',
|
|
Encrypted: 'Encrypted',
|
|
Guidance: 'Guidance',
|
|
ODEncrypted: 'Encrypted On-Disk',
|
|
Shrunk: 'Shrunk',
|
|
Deduped: 'De-duplicated'
|
|
},
|
|
def: 'New'
|
|
},
|
|
lock: {
|
|
'class': 'all',
|
|
type: 'select',
|
|
desc: 'Change Recording Lock',
|
|
negate: true,
|
|
select: {
|
|
1: 'Lock Recording',
|
|
0: 'Unlock Recording'
|
|
},
|
|
def: 1,
|
|
deprecated: true
|
|
},
|
|
filename: {
|
|
'class': 'all',
|
|
type: 'substr',
|
|
desc: 'Filename contains',
|
|
idesc: 'Filename does not contain',
|
|
negate: true,
|
|
def: 'Enter text here...'
|
|
},
|
|
fflag: {
|
|
'class': 'all',
|
|
type: 'string',
|
|
desc: 'Folder flagged as',
|
|
idesc: 'Folder not flagged as',
|
|
negate: true,
|
|
def: 'nosweep'
|
|
},
|
|
foldername: {
|
|
'class': 'all',
|
|
type: 'string',
|
|
desc: 'Folder name contains',
|
|
idesc: 'Folder name does not contain',
|
|
negate: true,
|
|
def: 'Enter text here...'
|
|
},
|
|
lastrule: {
|
|
'class': 'all',
|
|
type: 'noarg',
|
|
desc: 'Previous Rule Matched',
|
|
idesc: "Previous Rule didn't match",
|
|
negate: true,
|
|
def: ""
|
|
},
|
|
series: {
|
|
'class': 'folder',
|
|
type: 'noarg',
|
|
desc: 'Folder was created by series recording',
|
|
idesc: 'Folder was not created by series recording',
|
|
negate: true,
|
|
def: ""
|
|
},
|
|
'or': {
|
|
'class': 'all',
|
|
type: 'composite',
|
|
label: 'Or',
|
|
desc: 'If any of...',
|
|
negate: false,
|
|
def: ''
|
|
},
|
|
'and': {
|
|
'class': 'all',
|
|
type: 'composite',
|
|
label: 'And',
|
|
desc: 'If all of...',
|
|
negate: false,
|
|
def: ''
|
|
}
|
|
},
|
|
action: {
|
|
'continue': {
|
|
'class': 'all',
|
|
argtype: 'none',
|
|
desc: 'Continue on to next rule',
|
|
continues: true
|
|
},
|
|
stop: {
|
|
'class': 'all',
|
|
argtype: 'none',
|
|
desc: 'Do nothing and stop processing rules',
|
|
continues: false
|
|
},
|
|
move: {
|
|
'class': 'all',
|
|
argtype: 'folder',
|
|
desc: 'Move recording to folder...',
|
|
continues: false
|
|
},
|
|
movecreate: {
|
|
'class': 'all',
|
|
argtype: 'folder',
|
|
desc: 'Move recording to folder (creating if necessary)',
|
|
continues: false
|
|
},
|
|
copy: {
|
|
'class': 'all',
|
|
argtype: 'folder',
|
|
desc: 'Copy recording to folder...',
|
|
continues: false
|
|
},
|
|
copycreate: {
|
|
'class': 'all',
|
|
argtype: 'folder',
|
|
desc: 'Copy recording to folder (creating if necessary)',
|
|
continues: false
|
|
},
|
|
fileunder: {
|
|
'class': 'folder',
|
|
argtype: 'folder',
|
|
desc: 'Merge into first folder of same name found under...',
|
|
continues: false
|
|
},
|
|
fileundercreate: {
|
|
'class': 'folder',
|
|
argtype: 'folder',
|
|
desc: 'Merge into or create folder of ' +
|
|
'same name found under...',
|
|
continues: false
|
|
},
|
|
renamefile: {
|
|
'class': 'all',
|
|
argtype: 'filenamebase',
|
|
desc: 'Rename recording files to...',
|
|
continues: true
|
|
},
|
|
settitle: {
|
|
'class': 'all',
|
|
argtype: 'string',
|
|
desc: 'Set recording title to...',
|
|
continues: true
|
|
},
|
|
setguidance: {
|
|
'class': 'all',
|
|
argtype: 'string',
|
|
desc: 'Set recording guidance to...',
|
|
continues: true
|
|
},
|
|
lock: {
|
|
'class': 'all',
|
|
argtype: 'none',
|
|
desc: 'Lock recordings',
|
|
continues: true
|
|
},
|
|
unlock: {
|
|
'class': 'all',
|
|
argtype: 'none',
|
|
desc: 'Unlock recordings',
|
|
continues: true
|
|
},
|
|
'delete': {
|
|
'class': 'all',
|
|
argtype: 'none',
|
|
desc: 'Delete recordings',
|
|
continues: false
|
|
}
|
|
}
|
|
};
|
|
|
|
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%replace,New: ,,}}",
|
|
"name": "Remove New: prefix.",
|
|
"type": "file",
|
|
"enabled": "1",
|
|
"criteria": [
|
|
{
|
|
"negate": 0,
|
|
"cmd": "title",
|
|
"arg": "New:*"
|
|
}
|
|
],
|
|
"action": {
|
|
"cmd": "settitle",
|
|
"arg": "%orig%replace,New: ,,"
|
|
}
|
|
},
|
|
{
|
|
"raw": "title New:* action {settitle {%orig%replace,New: ,,}}",
|
|
"name": "Unnamed rule",
|
|
"type": "folder",
|
|
"enabled": "1",
|
|
"criteria": [
|
|
{
|
|
"negate": 0,
|
|
"cmd": "title",
|
|
"arg": "New:*"
|
|
}
|
|
],
|
|
"action": {
|
|
"cmd": "settitle",
|
|
"arg": "%orig%replace,New: ,,"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
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 = {};
|
|
$.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 'all':
|
|
select_file_criteria[k] = v.desc;
|
|
select_folder_criteria[k] = v.desc;
|
|
break;
|
|
}
|
|
});
|
|
|
|
var select_file_actions = {};
|
|
var select_folder_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 'all':
|
|
select_file_actions[k] = v.desc;
|
|
select_folder_actions[k] = v.desc;
|
|
break;
|
|
}
|
|
});
|
|
|