From: Calin Crisan Date: Sun, 6 Jul 2014 10:42:03 +0000 (+0300) Subject: dead remote cameras no longer block at startup X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=3ce5bfb77e3964c112a90bebd760164dc710d18a;p=motioneye-debian dead remote cameras no longer block at startup --- diff --git a/doc/todo.txt b/doc/todo.txt index 2de429f..c0c89a5 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -1,3 +1,2 @@ --> in continuare o camera remote moarta blocheaza intreg sistemul la load -> use minimum_frame_time -> implement custom camera frame sizes diff --git a/src/handlers.py b/src/handlers.py index a317f6a..9ad5c81 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -487,7 +487,11 @@ class ConfigHandler(BaseHandler): check_finished() else: # remote camera - remote.get_config(local_config, on_response_builder(camera_id, local_config)) + if local_config['@enabled']: + remote.get_config(local_config, on_response_builder(camera_id, local_config)) + + else: # don't try to reach the remote of the camera is disabled + on_response_builder(camera_id, local_config)(None) if length[0] == 0: self.finish_json({'cameras': []}) diff --git a/static/css/main.css b/static/css/main.css index 62b5e04..371548c 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -22,6 +22,12 @@ body { background-color: #212121; } +select, +input[type=text], +input[type=password] { + box-sizing: border-box; +} + /* fonts */ @@ -416,7 +422,7 @@ table.add-camera-dialog { table.add-camera-dialog select, table.add-camera-dialog input[type=text], table.add-camera-dialog input[type=password] { - width: 10em; + width: 17em; } diff --git a/static/js/main.js b/static/js/main.js index 6d25e9d..bae940c 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -273,19 +273,17 @@ function initUI() { }); /* fetch & push handlers */ - $('#videoDeviceSelect').change(function () { + $('#videoDeviceSelect').focus(function () { + /* remember the previously selected index */ + this._prevSelectedIndex = this.selectedIndex; + + }).change(function () { if ($('#videoDeviceSelect').val() === 'add') { runAddCameraDialog(); - if ($('#videoDeviceSelect').find('option').length > 1) { - $('#videoDeviceSelect')[0].selectedIndex = 0; - } - else { - $('#videoDeviceSelect')[0].selectedIndex = -1; - } - - updateConfigUi(); + this.selectedIndex = this._prevSelectedIndex; } else { + this._prevSelectedIndex = this.selectedIndex; beginProgress([$(this).val()]); fetchCurrentCameraConfig(endProgress); } @@ -692,7 +690,7 @@ function dict2CameraUi(dict) { /* errors while getting the configuration */ $('#videoDeviceSwitch')[0].error = true; - $('#videoDeviceSwitch')[0].checked = true; + $('#videoDeviceSwitch')[0].checked = false; updateConfigUi(); return; @@ -1150,14 +1148,19 @@ function fetchCurrentConfig(onFetch) { } videoDeviceSelect.append(''); - if (cameras.length) { /* at least one camera */ + var enabledCameras = cameras.filter(function (camera) {return camera['enabled'];}); + if (enabledCameras.length > 0) { /* prefer the first enabled camera */ + videoDeviceSelect[0].selectedIndex = cameras.indexOf(enabledCameras[0]); + fetchCurrentCameraConfig(); + } + else if (cameras.length) { /* a disabled camera */ videoDeviceSelect[0].selectedIndex = 0; fetchCurrentCameraConfig(); } else { /* no camera at all */ videoDeviceSelect[0].selectedIndex = -1; } - + updateConfigUi(); } @@ -1567,7 +1570,7 @@ function runAddCameraDialog() { } }); - deviceSelect.append(''); + deviceSelect.append(''); updateUi();