sweeper/webif/plugin/sweeper/schema.js

361 lines
6.7 KiB
JavaScript

var schema = {
criterion: {
lcn: {
'class': 'all',
type: 'int',
desc: 'Logical Channel Number',
def: "0"
},
duration: {
'class': 'all',
type: 'int',
desc: 'Recording duration (in minutes)',
def: "0"
},
schedduration: {
'class': 'all',
type: 'int',
desc: 'Scheduled duration (in minutes)',
def: "0"
},
size: {
'class': 'all',
type: 'int',
desc: 'Recording size (in bytes)',
def: "0"
},
hour: {
'class': 'all',
type: 'int',
desc: 'Hour in which the recording started',
def: "0"
},
age: {
'class': 'all',
type: 'int',
desc: 'Age (in hours)',
def: "0"
},
wage: {
'class': 'all',
type: 'int',
desc: 'Time since last watched, or recorded (in hours)',
def: "0"
},
title: {
'class': 'all',
type: 'substr',
desc: 'Recording Title contains',
def: 'Enter text here...'
},
synopsis: {
'class': 'all',
type: 'substr',
desc: 'Synopsis contains',
def: 'Enter text here...'
},
guidance: {
'class': 'all',
type: 'substr',
desc: 'Guidance Text contains',
def: 'Enter text here...'
},
genre: {
'class': 'all',
type: 'select',
desc: 'Recording Genre',
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',
select: {
SD: 'Standard Definition',
HD: 'High Definition'
},
def: 'SD'
},
flag: {
'class': 'all',
type: 'select',
desc: 'Recording Flagged as',
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',
select: {
1: 'Lock Recording',
0: 'Unlock Recording'
},
def: 1,
deprecated: true
},
fflag: {
'class': 'folder',
type: 'string',
desc: 'Folder flagged as',
def: 'noflatten'
}
},
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
},
lock: {
'class': 'all',
argtype: 'none',
desc: 'Lock recordings',
continues: true
},
unlock: {
'class': 'all',
argtype: 'none',
desc: 'Unlock recordings',
continues: true
},
movecreate: {
'class': 'all',
argtype: 'folder',
desc: 'Move 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
}
}
};
var macros = {
seriesfiler: {
desc: 'Series-Filer',
rules: [
{
"raw": "action {fileunder ""}",
"name": "Emulate Seriesfiler",
"type": "folder",
"enabled": "1",
"criteria": [],
"action": {
"cmd": "fileunder",
"arg": ""
}
}
]
},
example: {
desc: 'Example rules',
rules: [
{
"raw": "lcn {>= 70} lcn {<= 79} duration {>= 90} action {move Children/Films}",
"name": "Move any Children's films (by length)",
"type": "file",
"enabled": "0",
"criteria": [
{
"cmd": "lcn",
"arg": ">= 70"
},
{
"cmd": "lcn",
"arg": "<= 79"
},
{
"cmd": "duration",
"arg": ">= 90"
}
],
"action": {
"cmd": "move",
"arg": "Children/Films"
}
},
{
"raw": "lcn {>= 70} lcn {<= 79} genre Film action {move Children/Films}",
"name": "Move any Children's films (by genre)",
"type": "file",
"enabled": "0",
"criteria": [
{
"cmd": "lcn",
"arg": ">= 70"
},
{
"cmd": "lcn",
"arg": "<= 79"
},
{
"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;
}
});