]> www.vanbest.org Git - motioneye-debian/commitdiff
dead remote cameras no longer block at startup
authorCalin Crisan <ccrisan@gmail.com>
Sun, 6 Jul 2014 10:42:03 +0000 (13:42 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 6 Jul 2014 10:53:05 +0000 (13:53 +0300)
doc/todo.txt
src/handlers.py
static/css/main.css
static/js/main.js

index 2de429fe217e83cf2e09d3cfd155a717d3c9fc33..c0c89a51ffbaeaebeb4a9d3869044ceab800bd9b 100644 (file)
@@ -1,3 +1,2 @@
--> in continuare o camera remote moarta blocheaza intreg sistemul la load
 -> use minimum_frame_time
 -> implement custom camera frame sizes
index a317f6a528129cdeeaf579aae421aa53babcf508..9ad5c819fe0f6d0337e07c4c489cd6033adcd3f6 100644 (file)
@@ -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': []})
index 62b5e04fe3c6bf2fdceef8a4d5819f02acb9bd17..371548c627f62b7afe30b92b303885d5e1866836 100644 (file)
@@ -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;
 }
 
 
index 6d25e9dd8641ac4c45f7336559eb45865b999fbe..bae940c27b1f2e6ed97107b4628f0670161e713a 100644 (file)
@@ -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('<option value="add">add camera...</option>');
                 
-                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('<option value="remote">Remote device...</option>');
+        deviceSelect.append('<option value="remote">Remote motionEye camera...</option>');
         
         updateUi();