diff --git a/CMakeLists.txt b/CMakeLists.txt index 292fe8ff..0710bcca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ SET ( DEFAULT_AVAHI ON ) SET ( DEFAULT_USE_SHARED_AVAHI_LIBS ON ) SET ( DEFAULT_USE_SYSTEM_FLATBUFFERS_LIBS OFF ) SET ( DEFAULT_USE_SYSTEM_PROTO_LIBS OFF ) +SET ( DEFAULT_USE_SYSTEM_MBEDTLS_LIBS OFF ) SET ( DEFAULT_TESTS OFF ) IF ( ${CMAKE_SYSTEM} MATCHES "Linux" ) @@ -190,7 +191,7 @@ SET ( FLATBUFFERS_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/flatbuf ) SET ( PROTOBUF_INSTALL_BIN_DIR ${CMAKE_BINARY_DIR}/proto ) SET ( PROTOBUF_INSTALL_LIB_DIR ${CMAKE_BINARY_DIR}/proto ) -# check all json files +# check all json files FILE ( GLOB_RECURSE HYPERION_SCHEMAS RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/libsrc/*schema*.json ) SET( JSON_FILES config/hyperion.config.json.default @@ -298,6 +299,8 @@ if(WIN32) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup") endif() +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v") + # Use GNU gold linker if available if (NOT WIN32) include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/LDGold.cmake) @@ -310,7 +313,7 @@ endif() # setup -rpath to search for shared libs in BINARY/../lib folder if (UNIX AND NOT APPLE) - SET(CMAKE_SKIP_BUILD_RPATH FALSE) + SET(CMAKE_SKIP_BUILD_RPATH FALSE) SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:$ORIGIN/../lib") SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) @@ -367,7 +370,6 @@ if (ENABLE_V4L2) endif() endif (TURBOJPEG_FOUND) - if (TURBOJPEG_FOUND OR JPEG_FOUND) add_definitions(-DHAVE_JPEG_DECODER) endif() diff --git a/CompileHowto.md b/CompileHowto.md index 59518043..c9be191d 100644 --- a/CompileHowto.md +++ b/CompileHowto.md @@ -40,7 +40,7 @@ wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/ ``` sudo apt-get update -sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev +sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev zlib1g-dev ``` **on RPI you need the videocore IV headers** @@ -72,6 +72,7 @@ brew install python3 brew install cmake brew install libusb brew install doxygen +brew install zlib ``` ## Windows (WIP) diff --git a/CrossCompileHowto.md b/CrossCompileHowto.md index 8fd96a18..ac71d574 100644 --- a/CrossCompileHowto.md +++ b/CrossCompileHowto.md @@ -4,14 +4,14 @@ Use a clean Raspbian Stretch Lite (on target) and Ubuntu 18/19 (on host) to exec ## On the Target system (here Raspberry Pi) Install required additional packages. ``` -sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite aptitude show qt5-default rsync +sudo apt-get install qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite aptitude qt5-default rsync libssl-dev zlib1g-dev ``` ## On the Host system (here Ubuntu) Update the Ubuntu environment to the latest stage and install required additional packages. ``` sudo apt-get update sudo apt-get upgrade -sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite +sudo apt-get -qq -y install git rsync cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libqt5sql5-sqlite libssl-dev zlib1g-dev ``` Refine the target IP or hostname, plus userID as required and set-up cross-compilation environment: diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index 001a55f8..c68c6332 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -159,9 +159,19 @@ "conf_leds_layout_preview_l1": "Das ist die erste LED (Einspeisung)", "conf_leds_layout_preview_l2": "Das visualisiert die Richtung des Datenstroms (zweite/dritte LED)", "conf_leds_layout_cl_top": "Oben", + "conf_leds_layout_cl_topleft": "Oben Links (Ecke)", + "conf_leds_layout_cl_topright": "Oben Rechts (Ecke)", "conf_leds_layout_cl_bottom": "Unten", + "conf_leds_layout_cl_bottomleft": "Unten Links (Ecke)", + "conf_leds_layout_cl_bottomright": "Unten Rechts (Ecke)", "conf_leds_layout_cl_left": "Links", + "conf_leds_layout_cl_lefttop": "Links 0% - 50% von Oben", + "conf_leds_layout_cl_leftmiddle": "Links 25% - 75% Mitte", + "conf_leds_layout_cl_leftbottom": "Links 50% - 100% Unten", "conf_leds_layout_cl_right": "Rechts", + "conf_leds_layout_cl_righttop": "Rechts 0% - 50% von Oben", + "conf_leds_layout_cl_rightmiddle": "Rechts 25% - 75% Mitte", + "conf_leds_layout_cl_rightbottom": "Rechts 50% - 100% Unten", "conf_leds_layout_cl_gaglength": "Lückenlänge", "conf_leds_layout_cl_gappos": "Lückenposition", "conf_leds_layout_cl_inppos": "Einspeisepunkt", @@ -356,6 +366,7 @@ "wiz_hue_desc2": "Nun kannst du auswählen, welche der Lampen (IDs) hinzugefügt werden sollen. Mit der Position wählst du aus, wo die jeweilige Lampe \"im Bild\" sitzen soll. Deaktivierte Lampen werden nicht hinzugefügt. Als Hilfe zur Identifizierung kannst du sie mit einem Klick auf den rechten Button kurz aufleuchten lassen.", "wiz_hue_ip": "Hue Bridge IP:", "wiz_hue_username": "Benutzer ID:", + "wiz_hue_clientkey": "Clientkey:", "wiz_hue_create_user": "Neuen Benutzer erstellen", "wiz_hue_failure_ip": "Keine Hue Bridge gefunden, bitte überprüfe die IP", "wiz_hue_failure_connection": "Zeitüberschreitung. Bitte drücke die Taste auf deiner Hue Bridge rechtzeitig", @@ -368,6 +379,19 @@ "wiz_hue_searchb": "Suche nach Hue Bridge...", "wiz_hue_blinkblue": "Lasse ID $1 blau aufleuchten", "wiz_hue_ident": "Identifiziere", + "wiz_hue_e_create_user": "Neuen Benutzer und Clientkey erstellen", + "wiz_hue_e_clientkey_needed": "Für die Verwendung der Entertainment API, ist ein zum Usernamen passender Clientkey erforderlich. Bitte einen vorhandenen eingeben oder über die Schaltflächen unten einen neuen erstellen.", + "wiz_hue_e_use_groupid": "Gruppen ID $1 verwenden", + "wiz_hue_e_noegrpids": "Es wurden keine Entertainment Gruppen in dieser Hue Bridge gefunden.", + "wiz_hue_e_nogrpids": "Diese Hue Bridge hat keine definierten Gruppen, bitte erstelle zuvor wenigstens eine in der Hue App.", + "wiz_hue_e_noapisupport": "Der Assistent hat die Entertainment API Unterstützung deaktiviert und wird mit der klassischen API weitergeführt.", + "wiz_hue_e_noapisupport_hint": "Die Einstellung \"Hue Entertainment API verwenden\" wurde deaktiviert.", + "wiz_hue_e_title": "Philips Hue Entertainment Assistent", + "wiz_hue_e_intro1": "Dieser Assistent hilft dir bei der Konfiguration von Hyperion für Philips Hue Entertainment. Zu den Funktionen zählen ein automatisches finden der Hue Bridge, einen neuen Benutzer und dazugehörigen Clientkey zum verwenden der Entertainment API erstellen, eine Entertainment Gruppenauswahl und die zur Gruppe gehörenden Lampen unterschiedlichen Bereichen im Bild zuzuordnen, sowie weitere Einstellungen von Hyperion automatisch anzupassen. Kurz gesagt: Komplette Einrichtung mit ein paar Klicks.", + "wiz_hue_e_desc1": "Es wird automatisch nach der Hue Bridge gesucht, solltest sie nicht gefunden werden, gebe die IP an und drücke den \"neu laden\" Button. Danach benötigst du eine gültige Benutzer ID und den dazugehörigen Clientkey, damit die Entertainment API verwendet werden kann. Beides kann auch automatisch erstellt werden.", + "wiz_hue_e_desc2": "Nun kannst du die Entertainment Gruppe auswählen, welche die Lampen zur Verwendung mit Hyperion beinhaltet.", + "wiz_hue_e_desc3": "Nun kannst du auswählen, mit welcher Position die jeweilige Lampe \"im Bild\" sitzen soll. Eine Vorauswahl der Position, wurde Anhand der konfigurierten Positionen der Lampen in der Entertainment Gruppe gewählt. Dies ist nur eine Empfehlung und kann beliebig angepasst werden. Als Hilfe zur Identifizierung kannst du sie mit einem Klick auf den rechten Button kurz aufleuchten lassen und die Auswahl zu verbessern.", + "wiz_hue_e_use_group": "Gruppe verwenden", "wiz_cc_title": "Farbkalibrierungs Assistent", "wiz_cc_intro1": "Der Assistent wird dich durch die Kalibrierung deiner LEDs leiten. Sofern du Kodi nutzt, können die Bilder und Testvideos direkt an Kodi geschickt werden. Andernfalls musst du das Material selbst herunterladen und anwenden.", "wiz_cc_kwebs": "Kodi Webserver (IP:Port)", @@ -424,9 +448,20 @@ "edt_dev_spec_lightid_title": "Lampen ID(s)", "edt_dev_spec_lightid_itemtitle": "ID", "edt_dev_spec_transistionTime_title": "Übergangszeit", + "edt_dev_spec_blackLightsTimeout_title": "Signal Erkennung Timeout bei schwarz", + "edt_dev_spec_brightnessThreshold_title": "Signal Erkennung Helligkeitsminimum", "edt_dev_spec_switchOffOnBlack_title": "Aus bei schwarz", "edt_dev_spec_brightnessFactor_title": "Helligkeitsfaktor", - "edt_dev_spec_restoreOriginalState_title" : "Lampen Originalzustand wiederhestellen", + "edt_dev_spec_brightnessMin_title": "Helligkeit minimum", + "edt_dev_spec_brightnessMax_title": "Helligkeit maximum", + "edt_dev_spec_sslReadTimeout_title" : "Streamer lese Timeout", + "edt_dev_spec_sslHSTimeoutMin_title" : "Streamer Handshake minimum Timeout", + "edt_dev_spec_sslHSTimeoutMax_title" : "Streamer Handshake maximum Timeout", + "edt_dev_spec_verbose_title": "Logge alle Hue Commandos", + "edt_dev_spec_debugStreamer_title": "Streamer Debugging", + "edt_dev_spec_debugLevel_title": "Streamer Verbindung Debug Stufe", + "edt_dev_spec_restoreOriginalState_title" : "Lampen Originalzustand wiederherstellen", + "edt_dev_spec_useEntertainmentAPI_title": "Hue Entertainment API verwenden", "edt_dev_spec_ledType_title": "LED typ", "edt_dev_spec_uid_title": "UID", "edt_dev_spec_intervall_title": "Intervall", @@ -449,7 +484,9 @@ "edt_dev_spec_gpioBcm_title": "GPIO Pin", "edt_dev_spec_ledIndex_title": "LED index", "edt_dev_spec_colorComponent_title": "Farbkomponente", + "edt_dev_spec_clientKey_title": "Clientkey", "edt_dev_spec_printTimeStamp_title" : "Mit Zeitstempel", + "edt_dev_spec_groupId_title": "Gruppen ID", "edt_conf_general_enable_title": "Aktiviert", "edt_conf_general_enable_expl": "Wenn aktiviert, ist die Komponente aktiv.", "edt_conf_general_priority_title": "Priorität", @@ -479,6 +516,11 @@ "edt_conf_enum_bbclassic": "Klassisch", "edt_conf_enum_bbosd": "OSD", "edt_conf_enum_automatic": "Automatisch", + "edt_conf_enum_dl_nodebug": "kein Debugging", + "edt_conf_enum_dl_error": "nur Fehler", + "edt_conf_enum_dl_statechange": "bei Änderungen", + "edt_conf_enum_dl_informational": "informativ", + "edt_conf_enum_dl_verbose": "sehr detailiert", "edt_conf_enum_custom": "Benutzerdefiniert", "edt_conf_gen_heading_title": "Allgemeine Einstellungen", "edt_conf_gen_name_title": "Name der Konfiguration", diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index 5679fec7..ca16108a 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -157,10 +157,20 @@ "conf_leds_layout_preview_ledpower" : "Max. power consumption: $1 A", "conf_leds_layout_preview_l1" : "This is your first led (input position)", "conf_leds_layout_preview_l2" : "This visualizes the data direction (second/third led)", - "conf_leds_layout_cl_top" : "Top", - "conf_leds_layout_cl_bottom" : "Bottom", - "conf_leds_layout_cl_left" : "Left", - "conf_leds_layout_cl_right" : "Right", + "conf_leds_layout_cl_top": "Top", + "conf_leds_layout_cl_topleft": "Top Left (Corner)", + "conf_leds_layout_cl_topright": "Top Right (Corner)", + "conf_leds_layout_cl_bottom": "Bottom", + "conf_leds_layout_cl_bottomleft": "Bottom Left (Corner)", + "conf_leds_layout_cl_bottomright": "Bottom Right (Corner)", + "conf_leds_layout_cl_left": "Left", + "conf_leds_layout_cl_lefttop": "Left 0% - 50% Top", + "conf_leds_layout_cl_leftmiddle": "Left 25% - 75% Middle", + "conf_leds_layout_cl_leftbottom": "Left 50% - 100% Bottom", + "conf_leds_layout_cl_right": "Right", + "conf_leds_layout_cl_righttop": "Right 0% - 50% Top", + "conf_leds_layout_cl_rightmiddle": "Right 25% - 75% Middle", + "conf_leds_layout_cl_rightbottom": "Right 50% - 100% Bottom", "conf_leds_layout_cl_gaglength" : "Gap length", "conf_leds_layout_cl_gappos" : "gap position", "conf_leds_layout_cl_inppos" : "Input position", @@ -355,6 +365,7 @@ "wiz_hue_desc2" : "Now choose which lamps should be added. The position assigns the lamp to a specific position on your \"picture\". Disabled lamps won't be added. To identify single lamps press the button on the right.", "wiz_hue_ip" : "Hue Bridge IP:", "wiz_hue_username" : "User ID:", + "wiz_hue_clientkey" : "Clientkey:", "wiz_hue_create_user" : "Create new User", "wiz_hue_failure_ip" : "No Bridge found, please type in a valid ip", "wiz_hue_failure_connection" : "Timeout: Please press the bridge button within the period of 30 seconds", @@ -367,8 +378,21 @@ "wiz_hue_searchb": "Searching for bridge...", "wiz_hue_blinkblue": "Let ID $1 light up blue", "wiz_hue_ident" : "Identify", - "wiz_cc_title" : "Color calibration wizard", - "wiz_cc_intro1" : "This wizard will guide you through your led calibration. If you are using Kodi, the calibration pictures and videos can be send directly to kodi without further tasks on your side. If not, you need to download these files yourself and apply them, if the wizard wants it.", + "wiz_hue_e_create_user" : "Create new User and clientkey", + "wiz_hue_e_clientkey_needed": "A clientkey that matches the username is required to use the entertainment API. Please enter an existing one or use the button below to create a new one.", + "wiz_hue_e_use_groupid": "Use group ID $1", + "wiz_hue_e_noegrpids": "No entertainment groups in this Hue bridge defined.", + "wiz_hue_e_nogrpids": "This Hue bridge has no groups defined, please create at least one before with the Hue Apps.", + "wiz_hue_e_noapisupport": "The Wizard has disabled entertainment API support and will continue in classic mode.", + "wiz_hue_e_noapisupport_hint": "The option \"Use Hue Entertainment API\" was unchecked.", + "wiz_hue_e_title" : "Philips Hue Entertainment Wizard", + "wiz_hue_e_intro1" : "This wizards configures Hyperion for the well known Philips Hue Entertainment system. Features are Hue Bridge auto detection, user and clientkey creation, entertainment group selection and set group lights to a specific position on your picture and tune the Hyperion settings automatically! So in short: All you need are some clicks and you are done!", + "wiz_hue_e_desc1" : "It searches automatically for a hue bridge, in case it can't find one you need to provide the ip address and push the reload button on the right. Now you need a user id and the clientkey, if you don't have both, create a new one.", + "wiz_hue_e_desc2" : "Now choose your entertainment group, which has all your lights inside for use with Hyperion.", + "wiz_hue_e_desc3": "Now you can choose in which position the respective lamp should be \"in the picture\". A preselection of the position was made based on the configured positions of the lights in the entertainment group. This is just a recommendation and can be customized as desired. You can therefore highlight them briefly by clicking on the right button to improve the selection.", + "wiz_hue_e_use_group" : "Use group", + "wiz_cc_title" : "Colour calibration wizard", + "wiz_cc_intro1" : "This wizard will guide you through your led calibration. If you are using Kodi, the calibration pictures and videos can be sent directly to it without further actions on your side. If not, you will need to download these files yourself and display them when the wizard needs you to adjust the setting.", "wiz_cc_kwebs" : "Kodi webserver (IP:Port)", "wiz_cc_kodidiscon" : "Kodi webserver not found, proceed without Kodi support.", "wiz_cc_kodidisconlink" : "Download link pictures:", @@ -422,10 +446,21 @@ "edt_dev_spec_username_title" : "Username", "edt_dev_spec_lightid_title" : "Light ID(s)", "edt_dev_spec_lightid_itemtitle" : "ID", - "edt_dev_spec_transistionTime_title" : "Transistion time", + "edt_dev_spec_transistionTime_title" : "Transition time", + "edt_dev_spec_blackLightsTimeout_title": "Signal detection timeout on black", + "edt_dev_spec_brightnessThreshold_title": "Signal detection brightness minimum", "edt_dev_spec_switchOffOnBlack_title" : "Switch off on black", "edt_dev_spec_brightnessFactor_title" : "Brightness factor", + "edt_dev_spec_brightnessMin_title": "Brightness minimum", + "edt_dev_spec_brightnessMax_title": "Brightness maximum", + "edt_dev_spec_sslReadTimeout_title" : "Streamer read timeout", + "edt_dev_spec_sslHSTimeoutMin_title" : "Streamer handshake timeout minimum", + "edt_dev_spec_sslHSTimeoutMax_title" : "Streamer handshake timeout maximum", + "edt_dev_spec_verbose_title": "Log all Hue commands", + "edt_dev_spec_debugStreamer_title": "Streamer Debug", + "edt_dev_spec_debugLevel_title": "Streamer Connection Debug Level", "edt_dev_spec_restoreOriginalState_title" : "Restore lights' original state", + "edt_dev_spec_useEntertainmentAPI_title": "Use Hue Entertainment API", "edt_dev_spec_ledType_title" : "LED Type", "edt_dev_spec_uid_title" : "UID", "edt_dev_spec_intervall_title" : "Intervall", @@ -447,7 +482,10 @@ "edt_dev_spec_PBFiFo_title" : "Pi-Blaster FiFo", "edt_dev_spec_gpioBcm_title" : "GPIO Pin", "edt_dev_spec_ledIndex_title" : "LED index", - "edt_dev_spec_colorComponent_title" : "Color component", + "edt_dev_spec_colorComponent_title" : "Colour component", + "edt_dev_spec_printTimeStamp_title" : "Add timestamp", + "edt_dev_spec_clientKey_title" : "Clientkey", + "edt_dev_spec_groupId_title" : "Group Id", "edt_conf_general_enable_title" : "Activate", "edt_conf_general_enable_expl" : "If checked, the component is enabled.", "edt_conf_general_priority_title" : "Priority channel", @@ -477,6 +515,11 @@ "edt_conf_enum_bbclassic" : "Classic", "edt_conf_enum_bbosd" : "OSD", "edt_conf_enum_automatic" : "Automatic", + "edt_conf_enum_dl_nodebug": "No Debug", + "edt_conf_enum_dl_error": "Error", + "edt_conf_enum_dl_statechange": "State Change", + "edt_conf_enum_dl_informational": "Informational", + "edt_conf_enum_dl_verbose": "Verbose", "edt_conf_enum_custom": "Custom", "edt_conf_gen_heading_title" : "General Settings", "edt_conf_gen_name_title" : "Configuration name", diff --git a/assets/webconfig/js/content_general.js b/assets/webconfig/js/content_general.js index f99c5fe9..f0d459d4 100644 --- a/assets/webconfig/js/content_general.js +++ b/assets/webconfig/js/content_general.js @@ -180,9 +180,11 @@ $(document).ready( function() { //create introduction if(window.showOptHelp) + { createHint("intro", $.i18n('conf_general_intro'), "editor_container"); createHint("intro", $.i18n('conf_general_tok_desc'), "tok_desc_cont"); createHint("intro", $.i18n('conf_general_inst_desc'), "inst_desc_cont"); + } removeOverlay(); }); diff --git a/assets/webconfig/js/content_grabber.js b/assets/webconfig/js/content_grabber.js index 8ccb32dc..1402e722 100644 --- a/assets/webconfig/js/content_grabber.js +++ b/assets/webconfig/js/content_grabber.js @@ -1,205 +1,207 @@ $(document).ready( function() { - performTranslation(); - var conf_editor_v4l2 = null; - var conf_editor_fg = null; + performTranslation(); + var conf_editor_v4l2 = null; + var conf_editor_fg = null; var conf_editor_instCapt = null; var V4L2_AVAIL = window.serverInfo.grabbers.available.includes("v4l2"); - // Dynamic v4l2 enum schema - var v4l2_dynamic_enum_schema = { - "available_devices": - { - "type": "string", - "title": "edt_conf_v4l2_device_title", - "propertyOrder" : 1, - "required" : true - }, - "resolutions": - { - "type": "string", - "title": "edt_conf_v4l2_resolution_title", - "propertyOrder" : 4, - "required" : true - }, - "framerates": - { - "type": "string", - "title": "edt_conf_v4l2_framerate_title", - "propertyOrder" : 7, - "required" : true - } - }; + if(V4L2_AVAIL) { + // Dynamic v4l2 enum schema + var v4l2_dynamic_enum_schema = { + "available_devices": + { + "type": "string", + "title": "edt_conf_v4l2_device_title", + "propertyOrder" : 1, + "required" : true + }, + "resolutions": + { + "type": "string", + "title": "edt_conf_v4l2_resolution_title", + "propertyOrder" : 4, + "required" : true + }, + "framerates": + { + "type": "string", + "title": "edt_conf_v4l2_framerate_title", + "propertyOrder" : 7, + "required" : true + } + }; - // Build dynamic v4l2 enum schema parts - var buildSchemaPart = function(key, schema, device) { - if (schema[key]) { - var enumVals = []; - var enumTitelVals = []; - var v4l2_properties = JSON.parse(JSON.stringify(window.serverInfo.grabbers.v4l2_properties)); + // Build dynamic v4l2 enum schema parts + var buildSchemaPart = function(key, schema, device) { + if (schema[key]) { + var enumVals = []; + var enumTitelVals = []; + var v4l2_properties = JSON.parse(JSON.stringify(window.serverInfo.grabbers.v4l2_properties)); - if (key === 'available_devices') { - for (var i = 0; i < v4l2_properties.length; i++) { - enumVals.push(v4l2_properties[i]['device']); + if (key === 'available_devices') { + for (var i = 0; i < v4l2_properties.length; i++) { + enumVals.push(v4l2_properties[i]['device']); - v4l2_properties[i].hasOwnProperty('name') - ? enumTitelVals.push(v4l2_properties[i]['name']) - : enumTitelVals.push(v4l2_properties[i]['device']); - } - } else if (key == 'resolutions' || key == 'framerates') { - for (var i = 0; i < v4l2_properties.length; i++) { - if (v4l2_properties[i]['device'] == device) { - enumVals = enumTitelVals = v4l2_properties[i][key]; - break; - } - } - } + v4l2_properties[i].hasOwnProperty('name') + ? enumTitelVals.push(v4l2_properties[i]['name']) + : enumTitelVals.push(v4l2_properties[i]['device']); + } + } else if (key == 'resolutions' || key == 'framerates') { + for (var i = 0; i < v4l2_properties.length; i++) { + if (v4l2_properties[i]['device'] == device) { + enumVals = enumTitelVals = v4l2_properties[i][key]; + break; + } + } + } - window.schema.grabberV4L2.properties[key] = { - "type": schema[key].type, - "title": schema[key].title, - "enum": [].concat(["auto"], enumVals, ["custom"]), - "options" : - { - "enum_titles" : [].concat(["edt_conf_enum_automatic"], enumTitelVals, ["edt_conf_enum_custom"]), - }, - "propertyOrder" : schema[key].propertyOrder, - "required" : schema[key].required - }; - } - }; + window.schema.grabberV4L2.properties[key] = { + "type": schema[key].type, + "title": schema[key].title, + "enum": [].concat(["auto"], enumVals, ["custom"]), + "options" : + { + "enum_titles" : [].concat(["edt_conf_enum_automatic"], enumTitelVals, ["edt_conf_enum_custom"]), + }, + "propertyOrder" : schema[key].propertyOrder, + "required" : schema[key].required + }; + } + }; - // Switch between visible states - function toggleOption(option, state) { - $('[data-schemapath*="root.grabberV4L2.'+option+'"]').toggle(state); - if (state) ( - $('[data-schemapath*="root.grabberV4L2.'+option+'"]').addClass('col-md-12'), - $('label[for="root_grabberV4L2_'+option+'"]').css('left','10px'), - $('[id="root_grabberV4L2_'+option+'"]').css('left','10px') - ); - } + // Switch between visible states + function toggleOption(option, state) { + $('[data-schemapath*="root.grabberV4L2.'+option+'"]').toggle(state); + if (state) ( + $('[data-schemapath*="root.grabberV4L2.'+option+'"]').addClass('col-md-12'), + $('label[for="root_grabberV4L2_'+option+'"]').css('left','10px'), + $('[id="root_grabberV4L2_'+option+'"]').css('left','10px') + ); + } - // Watch all v4l2 dynamic fields - var setWatchers = function(schema) { - var path = 'root.grabberV4L2.'; - Object.keys(schema).forEach(function(key) { - conf_editor_v4l2.watch(path + key, function() { - var ed = conf_editor_v4l2.getEditor(path + key); - var val = ed.getValue(); + // Watch all v4l2 dynamic fields + var setWatchers = function(schema) { + var path = 'root.grabberV4L2.'; + Object.keys(schema).forEach(function(key) { + conf_editor_v4l2.watch(path + key, function() { + var ed = conf_editor_v4l2.getEditor(path + key); + var val = ed.getValue(); - if (key == 'available_devices') { - var V4L2properties = ['resolutions', 'framerates']; - if (val == 'custom') { - var grabberV4L2 = ed.parent; - V4L2properties.forEach(function(item) { - buildSchemaPart(item, v4l2_dynamic_enum_schema, 'none'); - grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item]; - grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item]; + if (key == 'available_devices') { + var V4L2properties = ['resolutions', 'framerates']; + if (val == 'custom') { + var grabberV4L2 = ed.parent; + V4L2properties.forEach(function(item) { + buildSchemaPart(item, v4l2_dynamic_enum_schema, 'none'); + grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item]; + grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item]; - grabberV4L2.removeObjectProperty(item); - delete grabberV4L2.cached_editors[item]; - grabberV4L2.addObjectProperty(item); + grabberV4L2.removeObjectProperty(item); + delete grabberV4L2.cached_editors[item]; + grabberV4L2.addObjectProperty(item); - conf_editor_v4l2.getEditor(path + item).enable(); - }); + conf_editor_v4l2.getEditor(path + item).enable(); + }); - toggleOption('device', true); - } else if (val == 'auto') { - V4L2properties.forEach(function(item) { - conf_editor_v4l2.getEditor(path + item).setValue('auto'); - conf_editor_v4l2.getEditor(path + item).disable(); - }); + toggleOption('device', true); + } else if (val == 'auto') { + V4L2properties.forEach(function(item) { + conf_editor_v4l2.getEditor(path + item).setValue('auto'); + conf_editor_v4l2.getEditor(path + item).disable(); + }); - (toggleOption('device', false), toggleOption('width', false), - toggleOption('height', false), toggleOption('fps', false)); - } else { - var grabberV4L2 = ed.parent; - V4L2properties.forEach(function(item) { - buildSchemaPart(item, v4l2_dynamic_enum_schema, val); - grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item]; - grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item]; + (toggleOption('device', false), toggleOption('width', false), + toggleOption('height', false), toggleOption('fps', false)); + } else { + var grabberV4L2 = ed.parent; + V4L2properties.forEach(function(item) { + buildSchemaPart(item, v4l2_dynamic_enum_schema, val); + grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item]; + grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item]; - grabberV4L2.removeObjectProperty(item); - delete grabberV4L2.cached_editors[item]; - grabberV4L2.addObjectProperty(item); + grabberV4L2.removeObjectProperty(item); + delete grabberV4L2.cached_editors[item]; + grabberV4L2.addObjectProperty(item); - conf_editor_v4l2.getEditor(path + item).enable(); - }); + conf_editor_v4l2.getEditor(path + item).enable(); + }); - toggleOption('device', false); - } - } + toggleOption('device', false); + } + } - if (key == 'resolutions') - val != 'custom' - ? (toggleOption('width', false), toggleOption('height', false)) - : (toggleOption('width', true), toggleOption('height', true)); + if (key == 'resolutions') + val != 'custom' + ? (toggleOption('width', false), toggleOption('height', false)) + : (toggleOption('width', true), toggleOption('height', true)); - if (key == 'framerates') - val != 'custom' - ? toggleOption('fps', false) - : toggleOption('fps', true); - }); - }); - }; + if (key == 'framerates') + val != 'custom' + ? toggleOption('fps', false) + : toggleOption('fps', true); + }); + }); + }; - // Insert dynamic v4l2 enum schema parts - Object.keys(v4l2_dynamic_enum_schema).forEach(function(key) { - buildSchemaPart(key, v4l2_dynamic_enum_schema, window.serverConfig.grabberV4L2.device); - }); + // Insert dynamic v4l2 enum schema parts + Object.keys(v4l2_dynamic_enum_schema).forEach(function(key) { + buildSchemaPart(key, v4l2_dynamic_enum_schema, window.serverConfig.grabberV4L2.device); + }); + } - if(window.showOptHelp) { - // Instance Capture - $('#conf_cont').append(createRow('conf_cont_instCapt')); - $('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); - $('#conf_cont_instCapt').append(createHelpTable(window.schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title"))); + if(window.showOptHelp) { + // Instance Capture + $('#conf_cont').append(createRow('conf_cont_instCapt')); + $('#conf_cont_instCapt').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); + $('#conf_cont_instCapt').append(createHelpTable(window.schema.instCapture.properties, $.i18n("edt_conf_instCapture_heading_title"))); - // Framegrabber - $('#conf_cont').append(createRow('conf_cont_fg')); - $('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); - $('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title"))); + // Framegrabber + $('#conf_cont').append(createRow('conf_cont_fg')); + $('#conf_cont_fg').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); + $('#conf_cont_fg').append(createHelpTable(window.schema.framegrabber.properties, $.i18n("edt_conf_fg_heading_title"))); // V4L2 - hide if not available - if(V4L2_AVAIL){ + if(V4L2_AVAIL) { $('#conf_cont').append(createRow('conf_cont_v4l')); $('#conf_cont_v4l').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); $('#conf_cont_v4l').append(createHelpTable(window.schema.grabberV4L2.properties, $.i18n("edt_conf_v4l2_heading_title"))); } - } else { - $('#conf_cont').addClass('row'); - $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); + } else { + $('#conf_cont').addClass('row'); + $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_instCapture_heading_title"), 'editor_container_instCapt', 'btn_submit_instCapt')); $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_fg_heading_title"), 'editor_container_fg', 'btn_submit_fg')); - if(V4L2_AVAIL){ + if(V4L2_AVAIL) { $('#conf_cont').append(createOptPanel('fa-camera', $.i18n("edt_conf_v4l2_heading_title"), 'editor_container_v4l2', 'btn_submit_v4l2')); } - } + } - // Instance Capture - conf_editor_instCapt = createJsonEditor('editor_container_instCapt', { - instCapture: window.schema.instCapture - }, true, true); + // Instance Capture + conf_editor_instCapt = createJsonEditor('editor_container_instCapt', { + instCapture: window.schema.instCapture + }, true, true); - conf_editor_instCapt.on('change',function() { - conf_editor_instCapt.validate().length ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false); - }); + conf_editor_instCapt.on('change',function() { + conf_editor_instCapt.validate().length ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false); + }); - $('#btn_submit_instCapt').off().on('click',function() { - requestWriteConfig(conf_editor_instCapt.getValue()); - }); + $('#btn_submit_instCapt').off().on('click',function() { + requestWriteConfig(conf_editor_instCapt.getValue()); + }); - // Framegrabber - conf_editor_fg = createJsonEditor('editor_container_fg', { - framegrabber: window.schema.framegrabber - }, true, true); + // Framegrabber + conf_editor_fg = createJsonEditor('editor_container_fg', { + framegrabber: window.schema.framegrabber + }, true, true); - conf_editor_fg.on('change',function() { - conf_editor_fg.validate().length ? $('#btn_submit_fg').attr('disabled', true) : $('#btn_submit_fg').attr('disabled', false); - }); + conf_editor_fg.on('change',function() { + conf_editor_fg.validate().length ? $('#btn_submit_fg').attr('disabled', true) : $('#btn_submit_fg').attr('disabled', false); + }); - $('#btn_submit_fg').off().on('click',function() { - requestWriteConfig(conf_editor_fg.getValue()); - }); + $('#btn_submit_fg').off().on('click',function() { + requestWriteConfig(conf_editor_fg.getValue()); + }); - if(V4L2_AVAIL){ + if(V4L2_AVAIL) { conf_editor_v4l2 = createJsonEditor('editor_container_v4l2', { grabberV4L2 : window.schema.grabberV4L2 }, true, true); @@ -258,35 +260,35 @@ $(document).ready( function() { }); } - ////////////////////////////////////////////////// + ////////////////////////////////////////////////// - //create introduction - if(window.showOptHelp) { + //create introduction + if(window.showOptHelp) { createHint("intro", $.i18n('conf_grabber_fg_intro'), "editor_container_fg"); if(V4L2_AVAIL){ createHint("intro", $.i18n('conf_grabber_v4l_intro'), "editor_container_v4l2"); } - } + } - function hideEl(el) { - for(var i = 0; i -1) - hideEl(["device","pixelDecimation"]); - else if (grabbers.indexOf('x11') > -1) - hideEl(["device","width","height"]); - else if (grabbers.indexOf('osx') > -1 ) - hideEl(["device","pixelDecimation"]); - else if (grabbers.indexOf('amlogic') > -1) - hideEl(["pixelDecimation"]); - }); + if (grabbers.indexOf('dispmanx') > -1) + hideEl(["device","pixelDecimation"]); + else if (grabbers.indexOf('x11') > -1) + hideEl(["device","width","height"]); + else if (grabbers.indexOf('osx') > -1 ) + hideEl(["device","pixelDecimation"]); + else if (grabbers.indexOf('amlogic') > -1) + hideEl(["pixelDecimation"]); + }); - removeOverlay(); + removeOverlay(); }); diff --git a/assets/webconfig/js/content_index.js b/assets/webconfig/js/content_index.js index 6c986298..4d6fdcbf 100644 --- a/assets/webconfig/js/content_index.js +++ b/assets/webconfig/js/content_index.js @@ -163,7 +163,6 @@ $(document).ready(function () { requestTokenAuthorization(loginToken) else loadContentTo("#page-content", "login") - } }); diff --git a/assets/webconfig/js/content_leds.js b/assets/webconfig/js/content_leds.js index 8c411708..3f9db645 100755 --- a/assets/webconfig/js/content_leds.js +++ b/assets/webconfig/js/content_leds.js @@ -39,12 +39,12 @@ function createLedPreview(leds, origin){ { var led = leds[idx]; var led_id='ledc_'+[idx]; - var bgcolor = "background-color:hsl("+(idx*360/leds.length)+",100%,50%);"; + var bgcolor = "background-color:hsla("+(idx*360/leds.length)+",100%,50%,0.75);"; var pos = "left:"+(led.hmin * canvas_width)+"px;"+ "top:"+(led.vmin * canvas_height)+"px;"+ "width:"+((led.hmax-led.hmin) * (canvas_width-1))+"px;"+ "height:"+((led.vmax-led.vmin) * (canvas_height-1))+"px;"; - leds_html += '
'+idx+'
'; + leds_html += '
'+((led.name) ? led.name : idx)+'
'; } $('#leds_preview').html(leds_html); $('#ledc_0').css({"background-color":"black","z-index":"12"}); @@ -496,9 +496,13 @@ $(document).ready(function() { $("#leddevices").off().on("change", function() { var generalOptions = window.serverSchema.properties.device; - // Modified schema enty "hardwareLedCount" in generalOptions to minimum LedCount + // Modified schema entry "hardwareLedCount" in generalOptions to minimum LedCount + var ledType = $(this).val(); - var specificOptions = window.serverSchema.properties.alldevices[$(this).val()]; + //philipshueentertainment backward fix + if(ledType == "philipshueentertainment") ledType = "philipshue"; + + var specificOptions = window.serverSchema.properties.alldevices[ledType]; conf_editor = createJsonEditor('editor_container', { generalOptions : generalOptions, specificOptions : specificOptions, @@ -506,21 +510,19 @@ $(document).ready(function() { var values_general = {}; var values_specific = {}; - var isCurrentDevice = (window.serverConfig.device.type == $(this).val()); + var isCurrentDevice = (window.serverConfig.device.type == ledType); - for(var key in window.serverConfig.device){ - if (key != "type" && key in generalOptions.properties) - values_general[key] = window.serverConfig.device[key]; + for(var key in window.serverConfig.device) { + if (key != "type" && key in generalOptions.properties) values_general[key] = window.serverConfig.device[key]; }; conf_editor.getEditor("root.generalOptions").setValue( values_general ); if (isCurrentDevice) { - var specificOptions_val = conf_editor.getEditor("root.specificOptions").getValue() + var specificOptions_val = conf_editor.getEditor("root.specificOptions").getValue(); for(var key in specificOptions_val){ - values_specific[key] = (key in window.serverConfig.device) ? window.serverConfig.device[key] : specificOptions_val[key]; + values_specific[key] = (key in window.serverConfig.device) ? window.serverConfig.device[key] : specificOptions_val[key]; }; - conf_editor.getEditor("root.specificOptions").setValue( values_specific ); }; @@ -528,18 +530,29 @@ $(document).ready(function() { conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false); // led controller sepecific wizards - if($(this).val() == "philipshue") - { - createHint("wizard", $.i18n('wiz_hue_title'), "btn_wiz_holder","btn_led_device_wiz"); - $('#btn_led_device_wiz').off().on('click',startWizardPhilipsHue); - } - else - { - $('#btn_wiz_holder').html("") - $('#btn_led_device_wiz').off(); - } + $('#btn_wiz_holder').html("") + $('#btn_led_device_wiz').off(); + + if(ledType == "philipshue") { + $('#root_specificOptions_useEntertainmentAPI').bind("change", function() { + var ledWizardType = (this.checked) ? "philipshueentertainment" : ledType; + var data = { type: ledWizardType }; + var hue_title = (this.checked) ? 'wiz_hue_e_title' : 'wiz_hue_title'; + changeWizard(data, hue_title, startWizardPhilipsHue); + }); + $("#root_specificOptions_useEntertainmentAPI").trigger("change"); + } + + function changeWizard(data, hint, fn) { + $('#btn_wiz_holder').html("") + createHint("wizard", $.i18n(hint), "btn_wiz_holder","btn_led_device_wiz"); + $('#btn_led_device_wiz').off().on('click', data , fn); + } }); + //philipshueentertainment backward fix + if(window.serverConfig.device.type == "philipshueentertainment") window.serverConfig.device.type = "philipshue"; + // create led device selection var ledDevices = window.serverInfo.ledDevices.available; var devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'ws2812spi']; diff --git a/assets/webconfig/js/ledsim.js b/assets/webconfig/js/ledsim.js index 75913b58..7fbdcbae 100644 --- a/assets/webconfig/js/ledsim.js +++ b/assets/webconfig/js/ledsim.js @@ -147,15 +147,19 @@ $(document).ready(function() { //roundRect(ledsCanvasNodeCtx, led.hmin * canvas_width, led.vmin * canvas_height, (led.hmax-led.hmin) * canvas_width, (led.vmax-led.vmin) * canvas_height, 4, true, colors[idx]) //ledsCanvasNodeCtx.fillRect(led.hmin * canvas_width, led.vmin * canvas_height, (led.hmax-led.hmin) * canvas_width, (led.vmax-led.vmin) * canvas_height); - ledsCanvasNodeCtx.fillStyle = (useColor) ? "rgba("+colors[cPos]+","+colors[cPos+1]+","+colors[cPos+2]+",0.9)" : "hsl("+(idx*360/leds.length)+",100%,50%)"; + ledsCanvasNodeCtx.fillStyle = (useColor) ? "rgba("+colors[cPos]+","+colors[cPos+1]+","+colors[cPos+2]+",0.75)" : "hsla("+(idx*360/leds.length)+",100%,50%,0.75)"; ledsCanvasNodeCtx.fill(twoDPaths[idx]); ledsCanvasNodeCtx.stroke(twoDPaths[idx]); if(toggleLedsNum) { - ledsCanvasNodeCtx.fillStyle = "blue"; + //ledsCanvasNodeCtx.shadowOffsetX = 1; + //ledsCanvasNodeCtx.shadowOffsetY = 1; + //ledsCanvasNodeCtx.shadowColor = "black"; + //ledsCanvasNodeCtx.shadowBlur = 4; + ledsCanvasNodeCtx.fillStyle = "white"; ledsCanvasNodeCtx.textAlign = "center"; - ledsCanvasNodeCtx.fillText(idx, (led.hmin * canvas_width) + ( ((led.hmax-led.hmin) * canvas_width) / 2), (led.vmin * canvas_height) + ( ((led.vmax-led.vmin) * canvas_height) / 2)); + ledsCanvasNodeCtx.fillText(((led.name) ? led.name : idx), (led.hmin * canvas_width) + ( ((led.hmax-led.hmin) * canvas_width) / 2), (led.vmin * canvas_height) + ( ((led.vmax-led.vmin) * canvas_height) / 2)); } // increment colorsPosition diff --git a/assets/webconfig/js/lib/jquery.i18n.js b/assets/webconfig/js/lib/jquery.i18n.js index 5fbfffb2..32d9b10d 100644 --- a/assets/webconfig/js/lib/jquery.i18n.js +++ b/assets/webconfig/js/lib/jquery.i18n.js @@ -247,7 +247,7 @@ String.locale = String.locale || $( 'html' ).attr( 'lang' ); if ( !String.locale ) { - if ( typeof window.navigator !== undefined ) { + if ( typeof window.navigator !== 'undefined' ) { nav = window.navigator; String.locale = nav.language || nav.userLanguage || ''; } else { diff --git a/assets/webconfig/js/lib/jquery.i18n.language.js b/assets/webconfig/js/lib/jquery.i18n.language.js index e596fbc8..be413924 100644 --- a/assets/webconfig/js/lib/jquery.i18n.language.js +++ b/assets/webconfig/js/lib/jquery.i18n.language.js @@ -360,7 +360,7 @@ // Check if the restore to Latin number flag is set: if ( integer ) { - if ( parseFloat( num, 10 ) === num ) { + if ( parseFloat( num ) === num ) { return num; } @@ -381,7 +381,7 @@ } } - return integer ? parseFloat( convertedNumber, 10 ) : convertedNumber; + return integer ? parseFloat( convertedNumber ) : convertedNumber; }, /** diff --git a/assets/webconfig/js/settings.js b/assets/webconfig/js/settings.js index 37e407b6..774603d8 100644 --- a/assets/webconfig/js/settings.js +++ b/assets/webconfig/js/settings.js @@ -157,20 +157,16 @@ $(document).ready( function() { { if(lsys != window.wSess[i].host+':'+window.wSess[i].port) { - var hyperionAddress - - if (window.wSess[i].address.indexOf(':') > -1 && window.wSess[i].address.length == 36) - hyperionAddress = 'http://['+window.wSess[i].address+']:'+window.wSess[i].port - else - hyperionAddress = 'http://'+window.wSess[i].address+':'+window.wSess[i].port - - $('#id_select').append(createSelOpt(hyperionAddress, window.wSess[i].host)) + var hyperionAddress = window.wSess[i].address; + if(hyperionAddress.indexOf(':') > -1 && hyperionAddress.length == 36) hyperionAddress = '['+hyperionAddress+']'; + hyperionAddress = 'http://'+hyperionAddress+':'+window.wSess[i].port; + $('#id_select').append(createSelOpt(hyperionAddress, window.wSess[i].name)); } } $('#id_btn_saveset').off().on('click',function() { $("#loading_overlay").addClass("overlay"); - window.location.href = $('#id_select').val() + window.location.href = $('#id_select').val(); }); }); diff --git a/assets/webconfig/js/streamer.js b/assets/webconfig/js/streamer.js index a7861a68..ee457f66 100644 --- a/assets/webconfig/js/streamer.js +++ b/assets/webconfig/js/streamer.js @@ -2,7 +2,7 @@ $(document).ready( function() { // check if browser supports streaming if(window.navigator.mediaDevices && window.navigator.mediaDevices.getDisplayMedia){ - $("#btn_streamer").toggle() + $("#btn_streamer").toggle(); } // variables diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index 60b4e283..845dcb7f 100644 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -109,7 +109,7 @@ function loadContent(event, forceRefresh) var lastSelectedInstance = getStorage('lastSelectedInstance', false); if (lastSelectedInstance && (lastSelectedInstance != window.currentHyperionInstance)) - if (typeof(window.serverInfo.instance[lastSelectedInstance].running) !== 'undefined' && window.serverInfo.instance[lastSelectedInstance].running) + if (typeof(window.serverInfo.instance[lastSelectedInstance].running) !== 'undefined' && window.serverInfo.instance[lastSelectedInstance].running) instanceSwitch(lastSelectedInstance); else removeStorage('lastSelectedInstance', false); @@ -890,12 +890,12 @@ function getReleases(callback) continue; if(releases[i].tag_name.includes('alpha')) - { + { if (sem = semverLite.gt(releases[i].tag_name, highestAlphaRelease.tag_name)) - highestAlphaRelease = releases[i]; + highestAlphaRelease = releases[i]; } else if (releases[i].tag_name.includes('beta')) - { + { if (sem = semverLite.gt(releases[i].tag_name, highestBetaRelease.tag_name)) highestBetaRelease = releases[i]; } @@ -907,7 +907,7 @@ function getReleases(callback) else { if (semverLite.gt(releases[i].tag_name, highestRelease.tag_name)) - highestRelease = releases[i]; + highestRelease = releases[i]; } } window.latestStableVersion = highestRelease; @@ -915,7 +915,7 @@ function getReleases(callback) window.latestAlphaVersion= highestAlphaRelease; window.latestRcVersion = highestRcRelease; - + if(window.serverConfig.general.watchedVersionBranch == "Beta" && semverLite.gt(highestBetaRelease.tag_name, highestRelease.tag_name)) window.latestVersion = highestBetaRelease; else @@ -951,4 +951,4 @@ function handleDarkMode() setStorage("darkMode", "on", false); $('#btn_darkmode_icon').removeClass('fa fa-moon-o'); $('#btn_darkmode_icon').addClass('fa fa-sun-o'); -} \ No newline at end of file +} diff --git a/assets/webconfig/js/wizard.js b/assets/webconfig/js/wizard.js index de33979e..b019b581 100644 --- a/assets/webconfig/js/wizard.js +++ b/assets/webconfig/js/wizard.js @@ -1,31 +1,31 @@ //clear priority and other tasks if people reload the page or lost connection while a wizard was active $(window.hyperion).one("ready", function(event) { - if(getStorage("wizardactive") === 'true') - { - requestPriorityClear(); - setStorage("wizardactive", false); - if(getStorage("kodiAddress") != null) - { - kodiAddress = getStorage("kodiAddress"); - sendToKodi("stop"); - } - } + if(getStorage("wizardactive") === 'true') + { + requestPriorityClear(); + setStorage("wizardactive", false); + if(getStorage("kodiAddress") != null) + { + kodiAddress = getStorage("kodiAddress"); + sendToKodi("stop"); + } + } }); -function resetWizard() +function resetWizard(reload) { - $("#wizard_modal").modal('hide'); - clearInterval(wIntveralId); - requestPriorityClear(); - setStorage("wizardactive", false); - $('#wizp1').toggle(true); - $('#wizp2').toggle(false); - $('#wizp3').toggle(false); - //cc - if(withKodi) - sendToKodi("stop"); - step = 0; - location.reload(); + $("#wizard_modal").modal('hide'); + clearInterval(wIntveralId); + requestPriorityClear(); + setStorage("wizardactive", false); + $('#wizp1').toggle(true); + $('#wizp2').toggle(false); + $('#wizp3').toggle(false); + //cc + if(withKodi) + sendToKodi("stop"); + step = 0; + if(!reload) location.reload(); } //rgb byte order wizard @@ -34,128 +34,128 @@ var new_rgb_order; function changeColor() { - var color = $("#wiz_canv_color").css('background-color'); + var color = $("#wiz_canv_color").css('background-color'); - if (color == 'rgb(255, 0, 0)') - { - $("#wiz_canv_color").css('background-color','rgb(0, 255, 0)'); - requestSetColor('0','255','0'); - } - else - { - $("#wiz_canv_color").css('background-color','rgb(255, 0, 0)'); - requestSetColor('255','0','0'); - } + if (color == 'rgb(255, 0, 0)') + { + $("#wiz_canv_color").css('background-color','rgb(0, 255, 0)'); + requestSetColor('0','255','0'); + } + else + { + $("#wiz_canv_color").css('background-color','rgb(255, 0, 0)'); + requestSetColor('255','0','0'); + } } function startWizardRGB() { - //create html - $('#wiz_header').html(''+$.i18n('wiz_rgb_title')); - $('#wizp1_body').html('

'+$.i18n('wiz_rgb_title')+'

'+$.i18n('wiz_rgb_intro1')+'

'+$.i18n('wiz_rgb_intro2')+'

'); - $('#wizp1_footer').html(''); - $('#wizp2_body').html('

'+$.i18n('wiz_rgb_expl')+'

'); - $('#wizp2_body').append('
'+$.i18n('edt_append_s')+'
'); - $('#wizp2_body').append(''); - $('#wizp2_body').append('
'); - $('#wizp2_footer').html(''); + //create html + $('#wiz_header').html(''+$.i18n('wiz_rgb_title')); + $('#wizp1_body').html('

'+$.i18n('wiz_rgb_title')+'

'+$.i18n('wiz_rgb_intro1')+'

'+$.i18n('wiz_rgb_intro2')+'

'); + $('#wizp1_footer').html(''); + $('#wizp2_body').html('

'+$.i18n('wiz_rgb_expl')+'

'); + $('#wizp2_body').append('
'+$.i18n('edt_append_s')+'
'); + $('#wizp2_body').append(''); + $('#wizp2_body').append('
'); + $('#wizp2_footer').html(''); - //open modal - $("#wizard_modal").modal({ - backdrop : "static", - keyboard: false, - show: true - }); + //open modal + $("#wizard_modal").modal({ + backdrop : "static", + keyboard: false, + show: true + }); - //listen for continue - $('#btn_wiz_cont').off().on('click',function() { - beginWizardRGB(); - $('#wizp1').toggle(false); - $('#wizp2').toggle(true); - }); + //listen for continue + $('#btn_wiz_cont').off().on('click',function() { + beginWizardRGB(); + $('#wizp1').toggle(false); + $('#wizp2').toggle(true); + }); } function beginWizardRGB() { - $("#wiz_switchtime_select").off().on('change',function() { - clearInterval(wIntveralId); - var time = $("#wiz_switchtime_select").val(); - wIntveralId = setInterval(function() { changeColor(); }, time*1000); - }); + $("#wiz_switchtime_select").off().on('change',function() { + clearInterval(wIntveralId); + var time = $("#wiz_switchtime_select").val(); + wIntveralId = setInterval(function() { changeColor(); }, time*1000); + }); - $('.wselect').change(function () { - var rgb_order = window.serverConfig.device.colorOrder.split(""); - var redS = $("#wiz_r_select").val(); - var greenS = $("#wiz_g_select").val(); - var blueS = rgb_order.toString().replace(/,/g,"").replace(redS, "").replace(greenS,""); + $('.wselect').change(function () { + var rgb_order = window.serverConfig.device.colorOrder.split(""); + var redS = $("#wiz_r_select").val(); + var greenS = $("#wiz_g_select").val(); + var blueS = rgb_order.toString().replace(/,/g,"").replace(redS, "").replace(greenS,""); - for (var i = 0; i'; - if(withKodi) - { - sendToKodi('playP',"HGradient"); - h +=''; - } - else - h += '

'+$.i18n('wiz_cc_lettvshowm', "gey_1, grey_2, grey_3, HGradient, VGradient")+'

'; - $('#wiz_cc_desc').html(h); - $('#wiz_cc_btn_sp').off().on('click', function(){ - switchPicture(["VGradient","grey_1","grey_2","grey_3","HGradient"]); - }); - } - if(step == 4) - { - updateWEditor(["red"]); - h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_red_title')); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_red_title')); - sendToKodi('playP',"red"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_red_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 5) - { - updateWEditor(["green"]); - h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_green_title')); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_green_title')); - sendToKodi('playP',"green"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_green_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 6) - { - updateWEditor(["blue"]); - h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_blue_title')); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_blue_title')); - sendToKodi('playP',"blue"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_blue_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 7) - { - updateWEditor(["cyan"]); - h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_cyan_title')); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_cyan_title')); - sendToKodi('playP',"cyan"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_cyan_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 8) - { - updateWEditor(["magenta"]); - h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_magenta_title')); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_magenta_title')); - sendToKodi('playP',"magenta"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_magenta_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 9) - { - updateWEditor(["yellow"]); - h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_yellow_title')); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_yellow_title')); - sendToKodi('playP',"yellow"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_yellow_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 10) - { - updateWEditor(["backlightThreshold","backlightColored"]); - h = $.i18n('wiz_cc_backlight'); - if(withKodi) - { - h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_black_title')); - sendToKodi('playP',"black"); - } - else - h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_black_title')); - $('#wiz_cc_desc').html(h); - } - if(step == 11) - { - updateWEditor([""], true); - h = '

'+$.i18n('wiz_cc_testintro')+'

'; - if(withKodi) - { - h += '

'+$.i18n('wiz_cc_testintrok')+'

'; - sendToKodi('stop'); - for(var i = 0; i '+txt+''; - } - h +='
'; - } - else - h += '

'+$.i18n('wiz_cc_testintrowok')+' '+$.i18n('wiz_cc_link')+'

'; - h += '

'+$.i18n('wiz_cc_summary')+'

'; - $('#wiz_cc_desc').html(h); + if(step == 2) + { + updateWEditor(["white"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_white_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_white_title')); + sendToKodi('playP',"white"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_white_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 3) + { + updateWEditor(["gammaRed","gammaGreen","gammaBlue"]); + h = '

'+$.i18n('wiz_cc_adjustgamma')+'

'; + if(withKodi) + { + sendToKodi('playP',"HGradient"); + h +=''; + } + else + h += '

'+$.i18n('wiz_cc_lettvshowm', "gey_1, grey_2, grey_3, HGradient, VGradient")+'

'; + $('#wiz_cc_desc').html(h); + $('#wiz_cc_btn_sp').off().on('click', function(){ + switchPicture(["VGradient","grey_1","grey_2","grey_3","HGradient"]); + }); + } + if(step == 4) + { + updateWEditor(["red"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_red_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_red_title')); + sendToKodi('playP',"red"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_red_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 5) + { + updateWEditor(["green"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_green_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_green_title')); + sendToKodi('playP',"green"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_green_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 6) + { + updateWEditor(["blue"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_blue_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_blue_title')); + sendToKodi('playP',"blue"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_blue_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 7) + { + updateWEditor(["cyan"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_cyan_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_cyan_title')); + sendToKodi('playP',"cyan"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_cyan_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 8) + { + updateWEditor(["magenta"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_magenta_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_magenta_title')); + sendToKodi('playP',"magenta"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_magenta_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 9) + { + updateWEditor(["yellow"]); + h = $.i18n('wiz_cc_adjustit',$.i18n('edt_conf_color_yellow_title')); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_yellow_title')); + sendToKodi('playP',"yellow"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_yellow_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 10) + { + updateWEditor(["backlightThreshold","backlightColored"]); + h = $.i18n('wiz_cc_backlight'); + if(withKodi) + { + h += '
'+$.i18n('wiz_cc_kodishould',$.i18n('edt_conf_color_black_title')); + sendToKodi('playP',"black"); + } + else + h += '
'+$.i18n('wiz_cc_lettvshow',$.i18n('edt_conf_color_black_title')); + $('#wiz_cc_desc').html(h); + } + if(step == 11) + { + updateWEditor([""], true); + h = '

'+$.i18n('wiz_cc_testintro')+'

'; + if(withKodi) + { + h += '

'+$.i18n('wiz_cc_testintrok')+'

'; + sendToKodi('stop'); + for(var i = 0; i '+txt+''; + } + h +='
'; + } + else + h += '

'+$.i18n('wiz_cc_testintrowok')+' '+$.i18n('wiz_cc_link')+'

'; + h += '

'+$.i18n('wiz_cc_summary')+'

'; + $('#wiz_cc_desc').html(h); - $('.videobtn').off().on('click', function(e){ - if(e.target.id == "stop") - sendToKodi("stop"); - else - sendToKodi("playV",e.target.id+'.mp4'); + $('.videobtn').off().on('click', function(e){ + if(e.target.id == "stop") + sendToKodi("stop"); + else + sendToKodi("playV",e.target.id+'.mp4'); - $(this).attr("disabled", true); - setTimeout(function(){$('.videobtn').attr("disabled", false)},10000); - }); + $(this).attr("disabled", true); + setTimeout(function(){$('.videobtn').attr("disabled", false)},10000); + }); - $('#btn_wiz_next').attr("disabled", true); - $('#btn_wiz_save').toggle(true); - } - else - { - $('#btn_wiz_next').attr("disabled", false); - $('#btn_wiz_save').toggle(false); - } + $('#btn_wiz_next').attr("disabled", true); + $('#btn_wiz_save').toggle(true); + } + else + { + $('#btn_wiz_next').attr("disabled", false); + $('#btn_wiz_save').toggle(false); + } } function updateWEditor(el, all) { - for (var key in cobj) - { - if(all === true || el[0] == key || el[1] == key || el[2] == key) - $('#editor_container_wiz [data-schemapath*=".'+profile+'.'+key+'"]').toggle(true); - else - $('#editor_container_wiz [data-schemapath*=".'+profile+'.'+key+'"]').toggle(false); - } + for (var key in cobj) + { + if(all === true || el[0] == key || el[1] == key || el[2] == key) + $('#editor_container_wiz [data-schemapath*=".'+profile+'.'+key+'"]').toggle(true); + else + $('#editor_container_wiz [data-schemapath*=".'+profile+'.'+key+'"]').toggle(false); + } } function startWizardCC() { - //create html - $('#wiz_header').html(''+$.i18n('wiz_cc_title')); - $('#wizp1_body').html('

'+$.i18n('wiz_cc_title')+'

'+$.i18n('wiz_cc_intro1')+'

'); - $('#wizp1_footer').html(''); - $('#wizp2_body').html('
'); - $('#wizp2_footer').html(''); + //create html + $('#wiz_header').html(''+$.i18n('wiz_cc_title')); + $('#wizp1_body').html('

'+$.i18n('wiz_cc_title')+'

'+$.i18n('wiz_cc_intro1')+'

'); + $('#wizp1_footer').html(''); + $('#wizp2_body').html('
'); + $('#wizp2_footer').html(''); - //open modal - $("#wizard_modal").modal({ - backdrop : "static", - keyboard: false, - show: true - }); + //open modal + $("#wizard_modal").modal({ + backdrop : "static", + keyboard: false, + show: true + }); - $('#wiz_cc_kodiip').off().on('change',function() { - kodiAddress = $(this).val(); - setStorage("kodiAddress", kodiAddress); - sendToKodi("msg", $.i18n('wiz_cc_kodimsg_start'), function(cb){ - if(cb == "error") - { - $('#kodi_status').html('

'+$.i18n('wiz_cc_kodidiscon')+'

'+$.i18n('wiz_cc_kodidisconlink')+' '+$.i18n('wiz_cc_link')+'

'); - withKodi = false; - } - else - { - $('#kodi_status').html('

'+$.i18n('wiz_cc_kodicon')+'

'); - withKodi = true; - } + $('#wiz_cc_kodiip').off().on('change',function() { + kodiAddress = $(this).val(); + setStorage("kodiAddress", kodiAddress); + sendToKodi("msg", $.i18n('wiz_cc_kodimsg_start'), function(cb){ + if(cb == "error") + { + $('#kodi_status').html('

'+$.i18n('wiz_cc_kodidiscon')+'

'+$.i18n('wiz_cc_kodidisconlink')+' '+$.i18n('wiz_cc_link')+'

'); + withKodi = false; + } + else + { + $('#kodi_status').html('

'+$.i18n('wiz_cc_kodicon')+'

'); + withKodi = true; + } - $('#btn_wiz_cont').attr('disabled', false); - }); - }); + $('#btn_wiz_cont').attr('disabled', false); + }); + }); - //listen for continue - $('#btn_wiz_cont').off().on('click',function() { - beginWizardCC(); - $('#wizp1').toggle(false); - $('#wizp2').toggle(true); - }); + //listen for continue + $('#btn_wiz_cont').off().on('click',function() { + beginWizardCC(); + $('#wizp1').toggle(false); + $('#wizp2').toggle(true); + }); - $('#wiz_cc_kodiip').trigger("change"); - colorLength = window.serverConfig.color.channelAdjustment; - cobj = window.schema.color.properties.channelAdjustment.items.properties; - websAddress = document.location.hostname+':'+window.serverConfig.webConfig.port; - imgAddress = 'http://'+websAddress+'/img/cc/'; - setStorage("wizardactive", true); + $('#wiz_cc_kodiip').trigger("change"); + colorLength = window.serverConfig.color.channelAdjustment; + cobj = window.schema.color.properties.channelAdjustment.items.properties; + websAddress = document.location.hostname+':'+window.serverConfig.webConfig.port; + imgAddress = 'http://'+websAddress+'/img/cc/'; + setStorage("wizardactive", true); - //check profile count - if(colorLength.length > 1) - { - $('#multi_cali').html('

'+$.i18n('wiz_cc_morethanone')+'

'); - for(var i = 0; i 1) + { + $('#multi_cali').html('

'+$.i18n('wiz_cc_morethanone')+'

'); + for(var i = 0; i'+$.i18n('wiz_hue_title')); - $('#wizp1_body').html('

'+$.i18n('wiz_hue_title')+'

'+$.i18n('wiz_hue_intro1')+'

'); - $('#wizp1_footer').html(''); - $('#wizp2_body').html('
'); - $('#wh_topcontainer').append('

'+$.i18n('wiz_hue_desc1')+'

'); - $('#wh_topcontainer').append(''); - $('#wizp2_body').append(''); - createTable("lidsh", "lidsb", "hue_ids_t"); - $('.lidsh').append(createTableRow([$.i18n('edt_dev_spec_lightid_title'),$.i18n('wiz_hue_pos'),$.i18n('wiz_hue_ident')], true)); - $('#wizp2_footer').html(''); - $('#wizp3_body').html(''+$.i18n('wiz_hue_press_link')+'


'); + if(typeof e.data.type != "undefined") hueType = e.data.type; - //open modal - $("#wizard_modal").modal({ - backdrop : "static", - keyboard: false, - show: true - }); + //create html - //listen for continue - $('#btn_wiz_cont').off().on('click',function() { - beginWizardHue(); - $('#wizp1').toggle(false); - $('#wizp2').toggle(true); - }); + var hue_title = 'wiz_hue_title'; + var hue_intro1 = 'wiz_hue_intro1'; + var hue_desc1 = 'wiz_hue_desc1'; + var hue_create_user = 'wiz_hue_create_user'; + if(hueType == 'philipshueentertainment') + { + hue_title = 'wiz_hue_e_title'; + hue_intro1 = 'wiz_hue_e_intro1'; + hue_desc1 = 'wiz_hue_e_desc1'; + hue_create_user = 'wiz_hue_e_create_user'; + } + $('#wiz_header').html(''+$.i18n(hue_title)); + $('#wizp1_body').html('

'+$.i18n(hue_title)+'

'+$.i18n(hue_intro1)+'

'); + $('#wizp1_footer').html(''); + $('#wizp2_body').html('
'); + $('#wh_topcontainer').append('

'+$.i18n(hue_desc1)+'

'); + $('#wh_topcontainer').append(); + $('#wh_topcontainer').append(''); + if(hueType == 'philipshue') + { + $('#usrcont').append('
'); + } + if(hueType == 'philipshueentertainment') + { + $('#usrcont').append('
'); + } + $('#usrcont').append('
'); + if(hueType == 'philipshueentertainment') + { + $('#wizp2_body').append(''); + createTable("gidsh", "gidsb", "hue_grp_ids_t"); + $('.gidsh').append(createTableRow([$.i18n('edt_dev_spec_groupId_title'),$.i18n('wiz_hue_e_use_group')], true)); + $('#wizp2_body').append(''); + } + else + { + $('#wizp2_body').append(''); + } + createTable("lidsh", "lidsb", "hue_ids_t"); + $('.lidsh').append(createTableRow([$.i18n('edt_dev_spec_lightid_title'),$.i18n('wiz_hue_pos'),$.i18n('wiz_hue_ident')], true)); + $('#wizp2_footer').html(''); + $('#wizp3_body').html(''+$.i18n('wiz_hue_press_link')+'


'); + + //open modal + $("#wizard_modal").modal({ + backdrop : "static", + keyboard: false, + show: true + }); + + //listen for continue + $('#btn_wiz_cont').off().on('click',function() { + beginWizardHue(); + $('#wizp1').toggle(false); + $('#wizp2').toggle(true); + }); } -function checkHueBridge(cb,hueUser){ - var usr = ""; +function checkHueBridge(cb,hueUser) { + var usr = (typeof hueUser != "undefined") ? hueUser : 'config'; + if(usr == 'config') $('#wiz_hue_discovered').html(""); + $.ajax({ + url: 'http://'+hueIPs[hueIPsinc].internalipaddress+'/api/'+usr, + type: "GET", + dataType: "json", + success: function( json ) { + if (json.config) { + cb(true, usr); + } else if( json.name && json.bridgeid && json.modelid) { + $('#wiz_hue_discovered').html("Bridge: " + json.name + ", Modelid: " + json.modelid + ", API-Version: " + json.apiversion); + cb(true); + } else { + cb(false); + } - if(typeof hueUser != "undefined") - usr = hueUser; - - $.ajax({ - url: 'http://'+hueIPs[hueIPsinc].internalipaddress+'/api/'+usr, - contentType: 'application/json', - type: 'GET', - timeout: 2000 - }) - .done( function( data, textStatus, jqXHR ) { - if( Array.isArray(data) && data[0].error) - { - if ( data[0].error.type == 3 || data[0].error.type == 4) - { - cb(true, usr); - } - else - { - cb(false); - } - } - else - { - cb(true, usr); - } - - }) - .fail( function( jqXHR, textStatus ) { - cb(false); - }); + }, + timeout: 2500 + }).fail(function() { + cb(false); + }); } -function checkUserResult(reply, usr){ +function checkBridgeResult(reply, usr){ + if(reply) + { + //abort checking, first reachable result is used + $('#wiz_hue_ipstate').html(""); + $('#ip').val(hueIPs[hueIPsinc].internalipaddress) - if(reply) - { - $('#wiz_hue_usrstate').html(""); - $('#wiz_hue_create_user').toggle(false); - $('#user').val(usr); - get_hue_lights(); - } - else - { - $('#wiz_hue_usrstate').html($.i18n('wiz_hue_failure_user')); - $('#wiz_hue_create_user').toggle(true); - } + //now check hue user on this bridge + $('#usrcont').toggle(true); + checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper"); + } + else + { + //increment and check again + if(hueIPs.length-1 > hueIPsinc) + { + hueIPsinc++; + checkHueBridge(checkBridgeResult); + } + else + { + $('#usrcont').toggle(false); + $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); + } + } }; -function checkBridgeResult(reply){ - if(reply) - { - //abort checking, first reachable result is used - $('#wiz_hue_ipstate').html(""); - $('#ip').val(hueIPs[hueIPsinc].internalipaddress) +function checkUserResult(reply, usr) { - //now check hue user on this bridge - $('#usrcont').toggle(true); - checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper"); - } - else - { - //increment and check again - if(hueIPs.length-1 > hueIPsinc) - { - hueIPsinc++; - checkHueBridge(checkBridgeResult); - } - else - { - $('#usrcont').toggle(false); - $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); - } - } + if(reply) + { + $('#user').val(usr); + if(hueType == 'philipshueentertainment' && $('#clientkey').val() == "") { + $('#usrcont').toggle(true); + $('#wiz_hue_usrstate').html($.i18n('wiz_hue_e_clientkey_needed')); + $('#wiz_hue_create_user').toggle(true); + } else { + $('#wiz_hue_usrstate').html(""); + $('#wiz_hue_create_user').toggle(false); + if(hueType == 'philipshue') + { + get_hue_lights(); + } + if(hueType == 'philipshueentertainment') + { + get_hue_groups(); + } + } + } + else + { + $('#wiz_hue_usrstate').html($.i18n('wiz_hue_failure_user')); + $('#wiz_hue_create_user').toggle(true); + } }; - function assignHuePos(id, pos) - { - var i = null; - - if(pos == "top") - i = huePosTop; - else if(pos == "bottom") - i = huePosBottom; - else if(pos == "left") - i = huePosLeft; - else if(pos == "right") - i = huePosRight; - else - i = huePosEntire; - - return i; - } - -function identHueId(id, off) +function assignHuePos(id, pos) { - if(off !== true) - { - setTimeout(identHueId,1500,id,true); - var put_data = '{"on":true,"bri":254,"hue":47000,"sat":254}'; - } - else - { - var put_data = '{"on":false}'; - } + var i = null; - $.ajax({ - url: 'http://'+$('#ip').val()+'/api/'+$('#user').val()+'/lights/'+id+'/state', - type: 'PUT', - timeout: 2000, - - data: put_data - }) + if(pos == "top") + i = huePosTop; + else if(pos == "topleft") + i = huePosTopLeft; + else if(pos == "topright") + i = huePosTopRight; + else if(pos == "bottom") + i = huePosBottom; + else if(pos == "bottomleft") + i = huePosBottomLeft; + else if(pos == "bottomright") + i = huePosBottomRight; + else if(pos == "left") + i = huePosLeft; + else if(pos == "lefttop") + i = huePosLeftTop; + else if(pos == "leftmiddle") + i = huePosLeftMiddle; + else if(pos == "leftbottom") + i = huePosLeftBottom; + else if(pos == "right") + i = huePosRight; + else if(pos == "righttop") + i = huePosRightTop; + else if(pos == "rightmiddle") + i = huePosRightMiddle; + else if(pos == "rightbottom") + i = huePosRightBottom; + else + i = huePosEntire; + + i.name = lightIDs[id].name; + return i; +} + +function identHueId(id, off, oState) +{ + if(off !== true) + { + setTimeout(identHueId,1500,id,true,oState); + var put_data = '{"on":true,"bri":254,"hue":47000,"sat":254}'; + } + else + { + var put_data = '{"on":'+oState.on+',"bri":' + oState.bri +',"hue":' + oState.hue +',"sat":' + oState.sat +'}'; + } + + $.ajax({ + url: 'http://'+$('#ip').val()+'/api/'+$('#user').val()+'/lights/'+id+'/state', + type: 'PUT', + timeout: 2000, + data: put_data + }) +} + +function useGroupId(id) +{ + $('#groupId').val(id); + groupLights = groupIDs[id].lights; + groupLightsLocations = groupIDs[id].locations; + get_hue_lights(); } function getHueIPs(){ - $('#wiz_hue_ipstate').html($.i18n('wiz_hue_searchb')); - $.ajax({ - url: 'https://discovery.meethue.com', - crossDomain: true, - type: 'GET', - timeout: 3000 - }) - .done( function( data, textStatus, jqXHR ) { - if(data.length == 0) - $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); - else - { - hueIPs = data; - checkHueBridge(checkBridgeResult); - } - }) - .fail( function( jqXHR, textStatus ) { - $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); - }); + $('#wiz_hue_ipstate').html($.i18n('wiz_hue_searchb')); + $.ajax({ + url: 'https://discovery.meethue.com', + crossDomain: true, + type: 'GET', + timeout: 3000 + }) + .done( function( data, textStatus, jqXHR ) { + if(data.length == 0) { + $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); + } else { + hueIPs = data; + checkHueBridge(checkBridgeResult); + } + }) + .fail( function( jqXHR, textStatus ) { + $('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip')); + }); }; +//return editor Value +function eV(vn) +{ + return (vn) ? conf_editor.getEditor("root.specificOptions." + vn).getValue() : ""; +} + function beginWizardHue() { - var usr = conf_editor.getEditor("root.specificOptions.username").getValue(); - if(usr != "") - { - $('#user').val(usr); - } + var usr = eV("username"); + if(usr != "") { + $('#user').val(usr); + } - //check if ip is empty/reachable/search for bridge - if(conf_editor.getEditor("root.specificOptions.output").getValue() == "") - { - getHueIPs(); - } - else - { - var ip = conf_editor.getEditor("root.specificOptions.output").getValue(); - $('#ip').val(ip); - hueIPs.push({internalipaddress : ip}); - checkHueBridge(checkBridgeResult); - } + if(hueType == 'philipshueentertainment') { + var clkey = eV("clientkey"); + if(clkey != "") + { + $('#clientkey').val(clkey); + } + } + //check if ip is empty/reachable/search for bridge + if(eV("output") == "") + { + getHueIPs(); + } + else + { + var ip = eV("output"); + $('#ip').val(ip); + hueIPs.unshift({internalipaddress : ip}); + if(usr != "") { + checkHueBridge(checkUserResult, usr); + }else{ + checkHueBridge(checkBridgeResult); + } + } - $('#retry_bridge').off().on('click', function(){ - hueIPs.push({internalipaddress : $('#ip').val()}); - hueIPsinc = 0; - checkHueBridge(checkBridgeResult); - }); + $('#retry_bridge').off().on('click', function(){ + if($('#ip').val()!="") hueIPs.unshift({internalipaddress : $('#ip').val()}); + hueIPsinc = 0; + var usr = $('#user').val(); + if(usr != "") { + checkHueBridge(checkUserResult, usr); + }else{ + checkHueBridge(checkBridgeResult); + } + }); - $('#retry_usr').off().on('click', function(){ - checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper"); - }); + $('#retry_usr').off().on('click', function(){ + checkHueBridge(checkUserResult,$('#user').val() ? $('#user').val() : "newdeveloper"); + }); - $('#btn_wiz_save').off().on("click", function(){ - var hueLedConfig = []; - var finalLightIds = []; + $('#wiz_hue_create_user').off().on('click',function() { + if($('#ip').val()!="") hueIPs.unshift({internalipaddress : $('#ip').val()}); + createHueUser(); + }); - //create hue led config - for(var key in lightIDs) - { - if($('#hue_'+key).val() != "disabled") - { - hueLedConfig.push(assignHuePos(key, $('#hue_'+key).val())); - finalLightIds.push(parseInt(key)); - } - } + $('#btn_wiz_save').off().on("click", function(){ + var hueLedConfig = []; + var finalLightIds = []; - var ledCount= Object.keys(lightIDs).length; + //create hue led config + for(var key in lightIDs) + { + if(hueType == 'philipshueentertainment') + { + if(groupLights.indexOf(key) == -1) continue; + } + if($('#hue_'+key).val() != "disabled") + { + finalLightIds.push(key); + var idx_content = assignHuePos(key, $('#hue_'+key).val()); + hueLedConfig.push(JSON.parse(JSON.stringify(idx_content))); + } + } - window.serverConfig.leds = hueLedConfig; + var sc = window.serverConfig; + sc.leds = hueLedConfig; - //Adjust gamma, brightness and compensation - var c = window.serverConfig.color.channelAdjustment[0]; - c.gammaBlue = 1.0; - c.gammaRed = 1.0; - c.gammaGreen = 1.0; - c.brightness = 100; - c.brightnessCompensation = 0; + //Adjust gamma, brightness and compensation + var c = sc.color.channelAdjustment[0]; + c.gammaBlue = 1.0; + c.gammaRed = 1.0; + c.gammaGreen = 1.0; + c.brightness = 100; + c.brightnessCompensation = 0; - //device config - var d = window.serverConfig.device; - d.output = $('#ip').val(); - d.lightIds = finalLightIds; - d.username = $('#user').val(); - d.type = "philipshue"; - d.hardwareLedCount = ledCount; - d.transitiontime = 1; - d.switchOffOnBlack = true; + //device config + var d = sc.device; + d.output = $('#ip').val(); + d.username = $('#user').val(); + d.type = 'philipshue'; + d.colorOrder = 'rgb'; + d.lightIds = finalLightIds; + d.latchTime = 0; + d.transitiontime = parseInt(eV("transitiontime") ); + d.restoreOriginalState = (eV("restoreOriginalState") == true); + d.switchOffOnBlack = (eV("switchOffOnBlack") == true); + d.brightnessFactor = parseFloat(eV("brightnessFactor")); - //smoothing off - window.serverConfig.smoothing.enable = false; + d.clientkey = $('#clientkey').val(); + d.groupId = parseInt($('#groupId').val()); + d.blackLightsTimeout = parseInt(eV("blackLightsTimeout")); + d.brightnessMin = parseFloat(eV("brightnessMin")); + d.brightnessMax = parseFloat(eV("brightnessMax")); + d.brightnessThreshold = parseFloat(eV("brightnessThreshold")); + d.sslReadTimeout = parseInt(eV("sslReadTimeout")); + d.sslHSTimeoutMin = parseInt(eV("sslHSTimeoutMin")); + d.sslHSTimeoutMax = parseInt(eV("sslHSTimeoutMax")); + d.verbose = (eV("verbose") == true); + d.debugStreamer = (eV("debugStreamer") == true); + d.debugLevel = (eV("debugLevel")); - requestWriteConfig(window.serverConfig, true); - resetWizard(); - }); + if(hueType == 'philipshue') + { + d.useEntertainmentAPI = false; + d.hardwareLedCount = finalLightIds.length; + d.rewriteTime = 0; + d.verbose = false; + //smoothing off + sc.smoothing.enable = false; + } - $('#btn_wiz_abort').off().on('click', resetWizard); + if(hueType == 'philipshueentertainment') + { + d.useEntertainmentAPI = true; + d.hardwareLedCount = groupLights.length; + d.rewriteTime = 20; + //smoothing on + sc.smoothing.enable = true; + } + requestWriteConfig(sc, true); + resetWizard(); + }); + + $('#btn_wiz_abort').off().on('click', resetWizard); } function createHueUser() { - var connectionRetries = 30; - var data = {"devicetype":"hyperion#"+Date.now()}; - var UserInterval = setInterval(function(){ - $.ajax({ - type: "POST", - url: 'http://'+$("#ip").val()+'/api', - processData: false, - timeout: 1000, - contentType: 'application/json', - data: JSON.stringify(data), - success: function(r) { - $('#wizp1').toggle(false); - $('#wizp2').toggle(false); - $('#wizp3').toggle(true); + var connectionRetries = 30; + var data = {"devicetype":"hyperion#"+Date.now()} + if(hueType == 'philipshueentertainment') + { + data = {"devicetype":"hyperion#"+Date.now(), "generateclientkey":true} + } + var UserInterval = setInterval(function(){ + $.ajax({ + type: "POST", + url: 'http://'+$("#ip").val()+'/api', + processData: false, + timeout: 1000, + contentType: 'application/json', + data: JSON.stringify(data), + success: function(r) { + $('#wizp1').toggle(false); + $('#wizp2').toggle(false); + $('#wizp3').toggle(true); - connectionRetries--; - $("#connectionTime").html(connectionRetries); - if(connectionRetries == 0) - { - abortConnection(UserInterval); - } - else - { - if (typeof r[0].error != 'undefined') - { - console.log(connectionRetries+": link not pressed"); - } - if (typeof r[0].success != 'undefined') - { - $('#wizp1').toggle(false); - $('#wizp2').toggle(true); - $('#wizp3').toggle(false); - $('#user').val(r[0].success.username); - checkHueBridge(checkUserResult,r[0].success.username); - clearInterval(UserInterval); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) { - $('#wizp1').toggle(false); - $('#wizp2').toggle(true); - $('#wizp3').toggle(false); - clearInterval(UserInterval); - } - }); - },1000); + connectionRetries--; + $("#connectionTime").html(connectionRetries); + if(connectionRetries == 0) { + abortConnection(UserInterval); + } + else + { + if (typeof r[0].error != 'undefined') { + console.log(connectionRetries+": link not pressed"); + } + if (typeof r[0].success != 'undefined') { + $('#wizp1').toggle(false); + $('#wizp2').toggle(true); + $('#wizp3').toggle(false); + if(r[0].success.username != 'undefined') { + $('#user').val(r[0].success.username); + conf_editor.getEditor("root.specificOptions.username").setValue( r[0].success.username ); + } + if(hueType == 'philipshueentertainment') + { + if(r[0].success.clientkey != 'undefined') { + $('#clientkey').val(r[0].success.clientkey); + conf_editor.getEditor("root.specificOptions.clientkey").setValue( r[0].success.clientkey ); + } + } + checkHueBridge(checkUserResult,r[0].success.username); + clearInterval(UserInterval); + } + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + $('#wizp1').toggle(false); + $('#wizp2').toggle(true); + $('#wizp3').toggle(false); + clearInterval(UserInterval); + } + }); + },1000); +} + +function get_hue_groups(){ + $.ajax({ + type: "GET", + url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/groups', + processData: false, + contentType: 'application/json', + success: function(r) { + if(Object.keys(r).length > 0) + { + $('#wh_topcontainer').toggle(false); + $('#hue_grp_ids_t').toggle(true); + + groupIDs = r; + + var gC = 0; + for(var groupid in r) + { + if(r[groupid].type=='Entertainment') + { + $('.gidsb').append(createTableRow([groupid+' ('+r[groupid].name+')', ''])); + gC++; + } + } + if(gC == 0) + { + noAPISupport('wiz_hue_e_noegrpids'); + } + } + else + { + noAPISupport('wiz_hue_e_nogrpids'); + } + } + }); +} + +function noAPISupport(txt) +{ + showNotification('danger', $.i18n('wiz_hue_e_title'), $.i18n('wiz_hue_e_noapisupport_hint')); + conf_editor.getEditor("root.specificOptions.useEntertainmentAPI").setValue( false ); + $("#root_specificOptions_useEntertainmentAPI").trigger("change"); + $('#btn_wiz_holder').append('
'+$.i18n('wiz_hue_e_noapisupport_hint')+'
'); + $('#hue_grp_ids_t').toggle(false); + var txt = (txt) ? $.i18n(txt) : $.i18n('wiz_hue_e_nogrpids'); + $('

'+txt+'
'+$.i18n('wiz_hue_e_noapisupport')+'

').insertBefore('#wizp2_body #hue_ids_t'); + $('#hue_id_headline').html($.i18n('wiz_hue_desc2')); + hueType = 'philipshue'; + get_hue_lights(); +} + +function get_light_state(id){ + $.ajax({ + type: "GET", + url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights/'+id, + processData: false, + contentType: 'application/json', + success: function(r) { + if(Object.keys(r).length > 0) + { + identHueId(id, false, r['state']); + } + } + }); } function get_hue_lights(){ - $.ajax({ - type: "GET", - url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights', - processData: false, - contentType: 'application/json', - success: function(r) { - if(Object.keys(r).length > 0) - { - $('#wh_topcontainer').toggle(false); - $('#hue_ids_t, #btn_wiz_save').toggle(true); - lightIDs = r; + $.ajax({ + type: "GET", + url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights', + processData: false, + contentType: 'application/json', + success: function(r) { + if(Object.keys(r).length > 0) + { + if(hueType == 'philipshue') + { + $('#wh_topcontainer').toggle(false); + } + $('#hue_ids_t, #btn_wiz_save').toggle(true); + lightIDs = r; + var lightOptions = [ + "top", "topleft", "topright", + "bottom", "bottomleft", "bottomright", + "left", "lefttop", "leftmiddle", "leftbottom", + "right", "righttop", "rightmiddle", "rightbottom", + "entire" + ]; - for(var lightid in r) - { + if(hueType == 'philipshue') + { + lightOptions.unshift("disabled"); + } - $('.lidsb').append(createTableRow([lightid+' ('+r[lightid].name+')', '',''])); - } + $('.lidsb').html(""); + var pos = ""; + for(var lightid in r) + { + if(hueType == 'philipshueentertainment') + { + if(groupLights.indexOf(lightid) == -1) continue; - $('.hue_sel_watch').bind("change", function(){ - var cC = 0; - for(var key in lightIDs) - { - if($('#hue_'+key).val() != "disabled") - { - cC++; - } - } - cC == 0 ? $('#btn_wiz_save').attr("disabled",true) : $('#btn_wiz_save').attr("disabled",false); - }); + if(groupLightsLocations.hasOwnProperty(lightid)) + { + lightLocation = groupLightsLocations[lightid]; + var x = lightLocation[0]; + var y = lightLocation[1]; + var z = lightLocation[2]; + var xval = (x < 0) ? "left" : "right"; + if(z != 1 && x >= -0.25 && x <= 0.25 ) xval = ""; + switch (z) + { + case 1: // top / Ceiling height + pos = "top" + xval; + break; + case 0: // middle / TV height + pos = (xval == "" && y >= 0.75) ? "bottom" : xval + "middle"; + break; + case -1: // bottom / Ground height + pos = xval + "bottom"; + break; + } + } + } + var options = ""; + for(var opt in lightOptions) + { + var val = lightOptions[opt]; + var txt = (val != 'entire' && val != 'disabled') ? 'conf_leds_layout_cl_' : 'wiz_hue_ids_'; + options+= '