Add more schemas + webui integration (#218)

* update schema
... need some fixing regarding schema, will come in next commit
This commit is contained in:
brindosch 2016-09-02 19:29:04 +02:00 committed by redPanther
parent 06c878e76f
commit c17c3bd273
3 changed files with 273 additions and 105 deletions

View File

@ -21,7 +21,7 @@
$(document).ready( function() { $(document).ready( function() {
webSocket = new WebSocket('ws://'+document.location.hostname+':19444'); webSocket = new WebSocket('ws://'+document.location.hostname+':'+hyperionport);
var serverInfo; var serverInfo;
webSocket.onerror = function(event) { webSocket.onerror = function(event) {
@ -34,16 +34,29 @@
}; };
webSocket.onmessage = function(response){ webSocket.onmessage = function(response){
logger = JSON.parse(response.data).result.properties.logger; parsedConfSchemaJSON = JSON.parse(response.data);
jsonServer = JSON.parse(response.data).result.properties.jsonServer; console.log(parsedConfSchemaJSON)
protoServer = JSON.parse(response.data).result.properties.protoServer;
boblightServer = JSON.parse(response.data).result.properties.boblightServer; schema_smoothing = parsedConfSchemaJSON.result.properties.smoothing;
udpListener = JSON.parse(response.data).result.properties.udpListener; schema_kodiVideoChecker = parsedConfSchemaJSON.result.properties.kodiVideoChecker;
webConfig = JSON.parse(response.data).result.properties.webConfig; schema_initialEffect = parsedConfSchemaJSON.result.properties.initialEffect;
//schema_grabber-v4l2 = parsedConfSchemaJSON.result.properties.grabber-v4l2;
schema_framegrabber = parsedConfSchemaJSON.result.properties.framegrabber;
schema_forwarder = parsedConfSchemaJSON.result.properties.forwarder;
schema_effects = parsedConfSchemaJSON.result.properties.effects;
schema_device = parsedConfSchemaJSON.result.properties.device;
schema_color = parsedConfSchemaJSON.result.properties.color;
schema_blackborderdetector = parsedConfSchemaJSON.result.properties.blackborderdetector;
schema_logger = parsedConfSchemaJSON.result.properties.logger;
schema_jsonServer = parsedConfSchemaJSON.result.properties.jsonServer;
schema_protoServer = parsedConfSchemaJSON.result.properties.protoServer;
schema_boblightServer = parsedConfSchemaJSON.result.properties.boblightServer;
schema_udpListener = parsedConfSchemaJSON.result.properties.udpListener;
schema_webConfig = parsedConfSchemaJSON.result.properties.webConfig;
var element = document.getElementById('editor_holder'); var element = document.getElementById('editor_holder');
//JSONEditor.defaults.options.theme = 'bootstrap3'; //JSONEditor.defaults.options.theme = 'bootstrap3';
var editor = new JSONEditor(element,{ var general_conf_editor = new JSONEditor(element,{
theme: 'bootstrap3', theme: 'bootstrap3',
disable_collapse: 'true', disable_collapse: 'true',
form_name_root: 'sa', form_name_root: 'sa',
@ -53,23 +66,33 @@
schema: { schema: {
title:' ', title:' ',
properties: { properties: {
logger, schema_blackborderdetector,
jsonServer, schema_color,
protoServer, schema_device,
boblightServer, schema_effects,
udpListener, schema_forwarder,
webConfig schema_framegrabber,
//schema_grabber-v4l2,
schema_initialEffect,
schema_kodiVideoChecker,
schema_smoothing,
schema_logger,
schema_jsonServer,
schema_protoServer,
schema_boblightServer,
schema_udpListener,
schema_webConfig
} }
} }
}); });
document.getElementById('submit').addEventListener('click',function() { document.getElementById('submit').addEventListener('click',function() {
// Get the value from the editor // Get the value from the editor
console.log(editor.getValue()); console.log(general_conf_editor.getValue());
}); });
$("[type='checkbox']").bootstrapSwitch(); // $("[type='checkbox']").bootstrapSwitch();
} }

View File

@ -28,6 +28,7 @@ var latestVersion;
var cleanLatestVersion; var cleanLatestVersion;
var parsedServerInfoJSON; var parsedServerInfoJSON;
var parsedUpdateJSON; var parsedUpdateJSON;
var parsedConfSchemaJSON;
var hyperionport = 19444; var hyperionport = 19444;
function button_reloaddata(){ function button_reloaddata(){

View File

@ -7,13 +7,15 @@
{ {
"type" : "object", "type" : "object",
"title" : "Logging", "title" : "Logging",
"required": ["level"],
"properties" : "properties" :
{ {
"level" : "level" :
{ {
"type" : "string", "type" : "string",
"enum" : ["silent", "warn", "verbose", "debug"], "enum" : ["silent", "warn", "verbose", "debug"],
"title" : "Log-Level" "title" : "Log-Level",
"default" : "warn"
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -21,6 +23,7 @@
"device" : "device" :
{ {
"type" : "object", "type" : "object",
"title" : "LED Device",
"required" : true, "required" : true,
"properties" : "properties" :
{ {
@ -54,6 +57,7 @@
"color" : "color" :
{ {
"type":"object", "type":"object",
"title" : "Color Calibration",
"required" : true, "required" : true,
"properties": "properties":
{ {
@ -363,37 +367,54 @@
"smoothing": "smoothing":
{ {
"type" : "object", "type" : "object",
"title" : "Smoothing",
"required": ["type"],
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Activate",
"default" : true
}, },
"type" : "type" :
{ {
"enum" : ["linear"] "type" : "string",
"title" : "Type",
"enum" : ["linear"],
"default" : "linear"
}, },
"time_ms" : "time_ms" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Time",
"minimum" : 25, "minimum" : 25,
"maximum": 600 "maximum": 600,
"default" : 200
}, },
"updateFrequency" : "updateFrequency" :
{ {
"type" : "number", "type" : "number",
"title" : "Update frequency",
"minimum" : 1.000, "minimum" : 1.000,
"maximum": 100.000 "maximum" : 100.000,
"default" : 25.000
}, },
"updateDelay" : "updateDelay" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Update delay",
"minimum" : 0, "minimum" : 0,
"maximum": 2048 "maximum": 2048,
"default" : 0
}, },
"continuousOutput" : "continuousOutput" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Continuous output",
"default" : true
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -404,79 +425,130 @@
"items": "items":
{ {
"type" : "object", "type" : "object",
"required": ["mode","standard"],
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Activate",
"default" : false
}, },
"device" : "device" :
{ {
"type" : "string" "type" : "string",
"title" : "Device",
"default" : "auto"
}, },
"input" : "input" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Input",
"default" : 0
}, },
"standard" : "standard" :
{ {
"type" : "string" "type" : "string",
"title" : "Video standard",
"enum" : ["PAL","NTSC"],
"default" : "PAL"
}, },
"width" : "width" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Width",
"default" : -1
}, },
"height" : "height" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Height",
"default" : -1
}, },
"frameDecimation" : "frameDecimation" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Frame decimation",
"default" : 2
}, },
"sizeDecimation" : "sizeDecimation" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Size decimation",
"default" : 6
}, },
"priority" : "priority" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Priority channel",
"default" : 900
}, },
"mode" : "mode" :
{ {
"type" : "string" "type" : "string",
"title" : "Mode",
"enum" : ["2D","3DSBS","3DTAB"],
"default" : "2D"
}, },
"useKodiChecker" : "useKodiChecker" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Use Kodi Watch",
"default" : false
}, },
"cropLeft" : "cropLeft" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Crop left",
"minimum" : 0,
"default" : 0
}, },
"cropRight" : "cropRight" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Crop right",
"minimum" : 0,
"default" : 0
}, },
"cropTop" : "cropTop" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Crop top",
"minimum" : 0,
"default" : 0
}, },
"cropBottom" : "cropBottom" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Crop bottom",
"minimum" : 0,
"default" : 0
}, },
"redSignalThreshold" : "redSignalThreshold" :
{ {
"type" : "number" "type" : "number",
"title" : "Red signal threshold",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.1
}, },
"greenSignalThreshold" : "greenSignalThreshold" :
{ {
"type" : "number" "type" : "number",
"title" : "Green signal threshold",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.1
}, },
"blueSignalThreshold" : "blueSignalThreshold" :
{ {
"type" : "number" "type" : "number",
"title" : "Blue signal threshold",
"minimum" : 0.0,
"maximum" : 1.0,
"default" : 0.1
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -485,74 +557,106 @@
"framegrabber" : "framegrabber" :
{ {
"type" : "object", "type" : "object",
"title" : "Framegrabber",
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Activate",
"default" : true
}, },
"type" : "type" :
{ {
"type" : "string" "type" : "string",
"title" : "Type"
}, },
"width" : "width" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Width",
"default" : 96
}, },
"height" : "height" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Height",
"default" : 96
}, },
"frequency_Hz" : "frequency_Hz" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Frequency",
"minimum" : 0,
"default" : 10
}, },
"priority" : "priority" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Priority channel",
"minimum" : 0,
"default" : 890
}, },
"cropLeft" : "cropLeft" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Crop left",
"minimum" : 0,
"default" : 0
}, },
"cropRight" : "cropRight" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Crop right",
"minimum" : 0,
"default" : 0
}, },
"cropTop" : "cropTop" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Crop top",
"minimum" : 0,
"default" : 0
}, },
"cropBottom" : "cropBottom" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Crop bottom",
"minimum" : 0,
"default" : 0
}, },
"useXGetImage" : "useXGetImage" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Use XGetImage",
"default" : false
}, },
"horizontalPixelDecimation" : "horizontalPixelDecimation" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Horizontal pixel decimation",
"minimum" : 0,
"default" : 8
}, },
"verticalPixelDecimation" : "verticalPixelDecimation" :
{ {
"type" : "integer", "type" : "integer",
"minimum" : 0 "title" : "Vertical pixel decimation",
"minimum" : 0,
"default" : 8
}, },
"device" : "device" :
{ {
"type" : "string" "type" : "string",
"title" : "Device",
"default" : "/dev/fb0"
}, },
"display" : "display" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Display",
"minimum" : 0 "minimum" : 0
} }
}, },
@ -561,44 +665,31 @@
"blackborderdetector" : "blackborderdetector" :
{ {
"type" : "object", "type" : "object",
"title" : "Blackbar detector",
"required": ["mode"],
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Activate",
"default" : true
}, },
"threshold" : "threshold" :
{ {
"type" : "number", "type" : "number",
"title" : "Threshold",
"minimum" : 0.0, "minimum" : 0.0,
"maximum" : 1.0 "maximum" : 1.0,
}, "default" : 0.05
"unknownFrameCnt" :
{
"type" : "number",
"minimum" : 0
},
"borderFrameCnt" :
{
"type" : "number",
"minimum" : 0
},
"maxInconsistentCnt" :
{
"type" : "number",
"minimum" : 0
},
"blurRemoveCnt" :
{
"type" : "number",
"minimum" : 0
}, },
"mode" : "mode" :
{ {
"type" : "type" : "string",
{ "title": "Mode",
"enum" : ["default", "classic", "osd"] "enum" : ["default", "classic", "osd"],
} "default" : "default"
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -606,47 +697,78 @@
"kodiVideoChecker" : "kodiVideoChecker" :
{ {
"type" : "object", "type" : "object",
"title" : "Kodi Watch",
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Activate",
"default" : false
}, },
"kodiAddress" : "kodiAddress" :
{ {
"type" : "string" "type" : "string",
"title" : "Kodi IP address",
"default" : "127.0.0.1"
}, },
"kodiTcpPort" : "kodiTcpPort" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Kodi TCP port",
"minimum" : 0,
"maximum" : 65535,
"default" : 9090
}, },
"grabVideo" : "grabVideo" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Video",
"default" : true
}, },
"grabPictures" : "grabPictures" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Pictures",
"default" : true
}, },
"grabAudio" : "grabAudio" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Audio",
"default" : true
}, },
"grabMenu" : "grabMenu" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Menu",
"default" : false
}, },
"grabPause" : "grabPause" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Pause",
"default" : false
}, },
"grabScreensaver" : "grabScreensaver" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Screensaver",
"default" : false
}, },
"enable3DDetection" : "enable3DDetection" :
{ {
"type" : "boolean" "type" : "boolean",
"format": "checkbox",
"title" : "Detect 3D",
"default" : false
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -654,27 +776,33 @@
"initialEffect" : "initialEffect" :
{ {
"type" : "object", "type" : "object",
"title" : "Initial Effect",
"properties" : "properties" :
{ {
"background-effect" : "background-effect" :
{ {
"type" : "array" "type" : "array",
"title" : "Background effect"
}, },
"background-effect-args" : "background-effect-args" :
{ {
"type" : "object" "type" : "object",
"title" : "Background effect arguments"
}, },
"foreground-effect" : "foreground-effect" :
{ {
"type" : "array" "type" : "array",
"title" : "Boot effect"
}, },
"foreground-effect-args" : "foreground-effect-args" :
{ {
"type" : "object" "type" : "object",
"title" : "Boot effect arguments"
}, },
"foreground-duration_ms" : "foreground-duration_ms" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Boot effect duration"
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -682,12 +810,15 @@
"forwarder" : "forwarder" :
{ {
"type" : "object", "type" : "object",
"title" : "Forwarder",
"required" : true, "required" : true,
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean", "type" : "boolean",
"format": "checkbox",
"title" : "Activate",
"required" : true "required" : true
}, },
"json" : "json" :
@ -716,7 +847,8 @@
"required" : true, "required" : true,
"title" : "Port", "title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535,
"default" : 19444
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -734,7 +866,8 @@
"required" : true, "required" : true,
"title" : "Port", "title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535,
"default" : 19445
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -749,7 +882,8 @@
{ {
"type" : "boolean", "type" : "boolean",
"format": "checkbox", "format": "checkbox",
"title" : "Activate" "title" : "Activate",
"default" : false
}, },
"port" : "port" :
{ {
@ -762,7 +896,9 @@
"priority" : "priority" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Priority" "title" : "Priority",
"minimum" : 0,
"default" : 800
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -777,12 +913,14 @@
{ {
"type" : "boolean", "type" : "boolean",
"format": "checkbox", "format": "checkbox",
"title" : "Activate" "title" : "Activate",
"default" : false
}, },
"address" : "address" :
{ {
"type" : "string", "type" : "string",
"title" : "Address", "title" : "Address",
"default" : "239.255.28.01",
"required" : true "required" : true
}, },
"port" : "port" :
@ -790,23 +928,27 @@
"type" : "integer", "type" : "integer",
"title" : "Port", "title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535,
"default" : 2801
}, },
"priority" : "priority" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Priority" "title" : "Priority",
"default" : 800
}, },
"timeout" : "timeout" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Timeout" "title" : "Timeout",
"default" : 10000
}, },
"shared" : "shared" :
{ {
"type" : "boolean", "type" : "boolean",
"format": "checkbox", "format": "checkbox",
"title" : "Shared" "title" : "Shared",
"default" : false
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -823,6 +965,7 @@
"type" : "boolean", "type" : "boolean",
"format": "checkbox", "format": "checkbox",
"title" : "Activate", "title" : "Activate",
"default" : true,
"required" : true "required" : true
}, },
"document_root" : "document_root" :
@ -835,6 +978,7 @@
{ {
"type" : "integer", "type" : "integer",
"title" : "Port", "title" : "Port",
"default" : 8099,
"required" : true "required" : true
} }
}, },