]> www.vanbest.org Git - motioneye-debian/commitdiff
motion and ffmpeg are no longer required (the add camera dialog behaves
authorCalin Crisan <ccrisan@gmail.com>
Sun, 30 Aug 2015 11:50:41 +0000 (14:50 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 30 Aug 2015 11:50:41 +0000 (14:50 +0300)
accordingly)

extra/motioneye.conf.sample
motioneye/handlers.py
motioneye/mediafiles.py
motioneye/meyectl.py
motioneye/motionctl.py
motioneye/remote.py
motioneye/server.py
motioneye/static/js/main.js
motioneye/templates/main.html

index 98b3b4d62cff1e8c58274215190b69dbee668f29..56f44142f0476c2c9f9137ae25e810659b6bffa3 100644 (file)
@@ -5,7 +5,7 @@
 #static_url '/static/'
 
 # path to the configuration directory (must be writable by motionEye)
-conf_path /etc/motioneye
+#conf_path /etc/motioneye
 
 # path to the directory where pid files go (must be writable by motionEye)
 #run_path /var/run
index 120d48105a1d78791cfef5e5cd601237e9eb7a94..29393e5ec58eef42e9d3aea44c0e45b177c87ea6 100644 (file)
@@ -158,7 +158,8 @@ class MainHandler(BaseHandler):
                 hostname=socket.gethostname(),
                 title=self.get_argument('title', None),
                 admin_username=config.get_main().get('@admin_username'),
-                old_motion=config.is_old_motion())
+                old_motion=config.is_old_motion(),
+                has_motion=bool(motionctl.find_motion()))
 
 
 class ConfigHandler(BaseHandler):
@@ -491,7 +492,6 @@ class ConfigHandler(BaseHandler):
                     self.finish_json({'error': error})
                     
                 else:
-                    cameras = [c for c in cameras if c.get('enabled')]
                     self.finish_json({'cameras': cameras})
 
             remote.list(self.get_data(), on_response)
index c4f615ecb13af39ea5094c7cd3a71fc46eefd6d6..88252b471deb9c6861e41cc86046c2959d603182 100644 (file)
@@ -153,7 +153,7 @@ def _remove_older_files(dir, moment, exts):
 
 def find_ffmpeg():
     try:
-        return subprocess.check_output('which ffmpeg', shell=True).strip()
+        return subprocess.check_output('which ffmpeg', stderr=open('/dev/null'), shell=True).strip()
     
     except subprocess.CalledProcessError: # not found
         return None
index 98782cb9651d5c399d62297f1ff689907010777c..823b13f232416d28f04525a52e346fd9e231b450 100755 (executable)
@@ -117,10 +117,10 @@ def load_settings():
 
 def configure_logging(cmd, log_to_file=False):
     if log_to_file or cmd != 'motioneye':
-        format = '%(asctime)s: [{cmd}] %(levelname)s: %(message)s'.format(cmd=cmd)
+        format = '%(asctime)s: [{cmd}] %(levelname)7s: %(message)s'.format(cmd=cmd)
         
     else:
-        format = '%(levelname)s: %(message)s'.format(cmd=cmd)
+        format = '%(levelname)7s: %(message)s'.format(cmd=cmd)
 
     for h in logging.getLogger().handlers:
         logging.getLogger().removeHandler(h)
index df27ae644a7ea4ac6318828b83d67d3e4663c6c3..1809eebd64e2d760354f6cc712b4594083a4250f 100644 (file)
@@ -52,7 +52,7 @@ def find_motion():
 
     else: # autodetect motion binary path
         try:
-            binary = subprocess.check_output('which motion', shell=True).strip()
+            binary = subprocess.check_output('which motion', stderr=open('/dev/null'), shell=True).strip()
         
         except subprocess.CalledProcessError: # not found
             return None
index a10599a32970c225baf50c4fb901e35c554c1058..374e410f52652ecf26e02b92b5f94a37b4eed165 100644 (file)
@@ -120,6 +120,12 @@ def list(local_config, callback):
     request = _make_request(scheme, host, port, username, password, uri + '/config/list/')
     
     def on_response(response):
+        def make_camera_response(c):
+            return {
+                'id': c['id'],
+                'name': c['name']
+            }
+        
         if response.error:
             logging.error('failed to list remote cameras on %(url)s: %(msg)s' % {
                     'url': pretty_camera_url(local_config, camera=False),
@@ -140,7 +146,8 @@ def list(local_config, callback):
         cameras = response['cameras']
         
         # filter out simple mjpeg cameras
-        cameras = [c for c in cameras if c['proto'] != 'mjpeg']
+        cameras = [make_camera_response(c) for c in cameras
+                if c['proto'] != 'mjpeg' and c.get('enabled')]
         
         callback(cameras)
     
index 1e138d05b3b46ff4c1c73adc617ffce99241457b..42696e2b844803dca3c389cac075fa9799d64339 100644 (file)
@@ -276,7 +276,11 @@ def test_requirements():
         sys.exit(-1)
 
     if not has_ffmpeg:
-        logging.info('ffmpeg not installed')
+        if has_motion:
+            logging.warn('you have motion installed, but no ffmpeg')
+        
+        else:
+            logging.info('ffmpeg not installed')
 
     if not has_motion:
         logging.info('motion not installed')
@@ -350,10 +354,10 @@ def run():
     import tornado.ioloop
 
     configure_signals()
-    test_requirements()
-
     logging.info('hello! this is motionEye server %s' % motioneye.VERSION)
 
+    test_requirements()
+
     if settings.SMB_SHARES:
 
         stop, start = smbctl.update_mounts()  # @UnusedVariable
index 10487015b78d052a88da553c2adec0a5ecef8a84..ebaca5b4eb944b645312f131e03d79e620912546 100644 (file)
@@ -2672,8 +2672,8 @@ function runAddCameraDialog() {
                 '<tr>' +
                     '<td class="dialog-item-label"><span class="dialog-item-label">Camera Type</span></td>' +
                     '<td class="dialog-item-value"><select class="styled" id="typeSelect">' +
-                        '<option value="v4l2">Local Camera</option>' +
-                        '<option value="netcam">Network Camera</option>' +
+                        (hasLocalCamSupport ? '<option value="v4l2">Local Camera</option>' : '') +
+                        (hasNetCamSupport ? '<option value="netcam">Network Camera</option>' : '') +
                         '<option value="motioneye">Remote motionEye Camera</option>' +
                         '<option value="mjpeg">Simple MJPEG Camera</option>' +
                     '</select></td>' +
@@ -2910,7 +2910,6 @@ function runAddCameraDialog() {
     urlEntry.change(updateUi);
     usernameEntry.change(updateUi);
     passwordEntry.change(updateUi);
-    updateUi();
 
     runModalDialog({
         title: 'Add Camera...',
@@ -2972,6 +2971,8 @@ function runAddCameraDialog() {
             });
         }
     });
+
+    updateUi();
 }
 
 function runTimelapseDialog(cameraId, groupKey, group) {
index 199e08f46196da61f526d9ca860247a0c3cd34c3..393ab5172ee9090b9258c3a8c9edb11b416b2866 100644 (file)
@@ -68,6 +68,8 @@
         var adminUsername = '{{admin_username}}';
         var frame = {% if frame %}true{% else %}false{% endif %};
         var baseUri = null;
+        var hasLocalCamSupport = {% if has_motion %}true{% else %}false{% endif %};
+        var hasNetCamSupport = {% if has_motion %}true{% else %}false{% endif %};
     </script>
 {% endblock %}