]> www.vanbest.org Git - motioneye-debian/commitdiff
integration with setuptools almost complete
authorCalin Crisan <ccrisan@gmail.com>
Sun, 30 Aug 2015 10:07:26 +0000 (13:07 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 30 Aug 2015 10:13:11 +0000 (13:13 +0300)
MANIFEST.in
README.md [deleted file]
README.rst [new file with mode: 0644]
extra/motioneye.init-debian [new file with mode: 0755]
extra/motioneye.systemd-unit [new file with mode: 0644]
motioneye/meyectl.py
motioneye/relayevent.py
motioneye/sendmail.py
motioneye/server.py
motioneye/webhook.py
setup.py

index 1c2510d773e62529b1c22eb0ca5c741fbabfd5c4..24b32fcefb445c6376363674dfc0179bf285de00 100644 (file)
@@ -1,2 +1 @@
-include README.md
-
+recursive-include extra *
diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index de116c1..0000000
--- a/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# motionEye, the motion frontend #\r
-\r
-**motionEye **is a web-based user interface for [motion](http://www.lavrsen.dk/foswiki/bin/view/Motion).\r
-\r
-## Requirements ##\r
-\r
- * a machine running Linux\r
- * python 2.6+\r
- * tornado 3.1+\r
- * jinja2\r
- * PIL\r
- * pycurl\r
- * motion\r
- * ffmpeg\r
- * v4l-utils\r
-\r
-## Installation ##\r
-\r
- 1. download the latest version from [bitbucket](https://bitbucket.org/ccrisan/motioneye/downloads) (use the *Tags* tab).\r
- 2. extract the archive to a directory of your choice (e.g. your home directory):\r
\r
-        cd /home/user\r
-        tar zxvf ccrisan-motioneye-xyz.tar.gz\r
-        mv ccrisan-motioneye-xyz motioneye\r
\r
- 3. create a `settings.py` file using the default template file (the default settings should do for now):\r
-\r
-        cd motioneye \r
-        cp settings_default.py settings.py\r
\r
- 4. motionEye can be run directly from the extracted directory; no root privileges are required:\r
\r
-        ./motioneye.py\r
\r
- 5. point your favourite browser to <http://localhost:8765>\r
diff --git a/README.rst b/README.rst
new file mode 100644 (file)
index 0000000..c5bee56
--- /dev/null
@@ -0,0 +1 @@
+**motionEye** is a web-based frontend for `motion <http://www.lavrsen.dk/foswiki/bin/view/Motion>`_.\r
diff --git a/extra/motioneye.init-debian b/extra/motioneye.init-debian
new file mode 100755 (executable)
index 0000000..5d2d294
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh -e
+#
+# /etc/init.d/motioneye: Start the motionEye server
+#
+### BEGIN INIT INFO
+# Provides:      motioneye
+# Required-Start: $local_fs $syslog $remote_fs
+# Required-Stop: $remote_fs
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start the motionEye server
+# Description: Start the motionEye server
+### END INIT INFO
+
+NAME="motioneye"
+PATH_BIN="/bin:/usr/bin:/sbin:/usr/sbin"
+DAEMON="/usr/bin/meyectl"
+PIDFILE="/var/run/$NAME.pid"
+DESC="motionEye server"
+USER="motion"
+OPTIONS="startserver -c /etc/motioneye/motioneye.conf -l"
+
+. /lib/lsb/init-functions
+
+test -x $DAEMON || exit 0
+
+RET=0
+
+case "$1" in
+    start)
+        log_daemon_msg "Starting $DESC"
+        if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid $USER -- $OPTIONS; then
+            log_end_msg 0
+        else
+            log_end_msg 1
+            RET=1
+        fi
+        ;;
+
+    stop)
+        log_daemon_msg "Stopping $DESC"
+        if start-stop-daemon --stop --oknodo --exec $DAEMON --retry 5; then
+            log_end_msg 0
+        else
+            log_end_msg 1
+            RET=1
+        fi
+        ;;
+
+    restart)
+        log_action_begin_msg "Restarting $DESC"
+        if $0 stop && $0 start; then
+            log_action_end_msg 0
+        else
+            log_action_cont_msg "(failed)"
+            RET=1
+        fi
+        ;;
+
+    status)
+        status_of_proc $DAEMON $NAME
+        ;;
+
+    *)
+        echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}"
+        RET=1
+        ;;
+esac
+
+exit $RET
+
diff --git a/extra/motioneye.systemd-unit b/extra/motioneye.systemd-unit
new file mode 100644 (file)
index 0000000..3456142
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=motionEye Server
+
+[Service]
+ExecStart=/usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
+Restart=on-abort
+
+[Install]
+WantedBy=multi-user.target
index cfa3320a577aac8290576cc96d1faa3b7eeea1cb..98782cb9651d5c399d62297f1ff689907010777c 100755 (executable)
@@ -116,7 +116,11 @@ def load_settings():
 
 
 def configure_logging(cmd, log_to_file=False):
-    format = '%(asctime)s: [{cmd}] %(levelname)s: %(message)s'.format(cmd=cmd)
+    if log_to_file or cmd != 'motioneye':
+        format = '%(asctime)s: [{cmd}] %(levelname)s: %(message)s'.format(cmd=cmd)
+        
+    else:
+        format = '%(levelname)s: %(message)s'.format(cmd=cmd)
 
     for h in logging.getLogger().handlers:
         logging.getLogger().removeHandler(h)
@@ -168,6 +172,8 @@ def make_arg_parser(command=None):
             action='store_true', dest='debug')
     parser.add_argument('-h', help='print this help and exit',
             action='help', default=argparse.SUPPRESS)
+    parser.add_argument('-l', help='log to file instead of standard error',
+            action='store_true', dest='log_to_file')
     parser.add_argument('-v', help='print program version and exit',
             action='version', default=argparse.SUPPRESS)
 
index 2a91ba50d3b72ca10790c88e419b227a085f0983..166287b55f1b3333f10dd8ff17ac976db9efdbc2 100644 (file)
@@ -98,7 +98,7 @@ def main(parser, args):
     
     options = parse_options(parser, args)
     
-    meyectl.configure_logging('relayevent')
+    meyectl.configure_logging('relayevent', options.log_to_file)
     meyectl.configure_tornado()
 
     logging.debug('hello!')
index df59222fe5c12a797c5b710e36a8e9816120bffa..ee3b6f36ce2a9b331370c8d5e3404269da8faad4 100644 (file)
@@ -142,7 +142,7 @@ def main(parser, args):
     
     options = parse_options(parser, args)
     
-    meyectl.configure_logging('sendmail')
+    meyectl.configure_logging('sendmail', options.log_to_file)
     meyectl.configure_tornado()
 
     logging.debug('hello!')
index 3913873d03b6e5824838ae43337498a58cd2d0a1..1e138d05b3b46ff4c1c73adc617ffce99241457b 100644 (file)
@@ -15,7 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-import argparse
 import atexit
 import datetime
 import logging
@@ -401,7 +400,7 @@ def main(parser, args, command):
     
     options = parse_options(parser, args)
     
-    meyectl.configure_logging('motioneye', options.background)
+    meyectl.configure_logging('motioneye', options.background or options.log_to_file)
     meyectl.configure_tornado()
 
     if command == 'start':
index 2767c6c468045302d5e1d0eeacb6a710cd14560f..2e7988a5dd8673e49182e0e6987b627b0325de01 100644 (file)
@@ -34,7 +34,7 @@ def main(parser, args):
     
     options = parse_options(parser, args)
     
-    meyectl.configure_logging('webhook')
+    meyectl.configure_logging('webhook', options.log_to_file)
     meyectl.configure_tornado()
 
     logging.debug('hello!')
index b963858685ad84ab46633c7fb287814e59f0d63e..2f6dfe2381e3fa3c3bc17a137ead93daace15b9a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,19 +1,23 @@
 
-# Always prefer setuptools over distutils
+import os.path
+
 from setuptools import setup
-# To use a consistent encoding
 from codecs import open
-from os import path
 
-here = path.abspath(path.dirname(__file__))
+import motioneye
+
 
-with open(path.join(here, 'README.md'), encoding='utf-8') as f:
+here = os.path.abspath(os.path.dirname(__file__))
+name = 'motioneye'
+version = motioneye.VERSION
+
+with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
     long_description = f.read()
 
-setup(
-    name='motioneye',
 
-    version='0.25.2',
+setup(
+    name=name,
+    version=version,
 
     description='motionEye server',
     long_description=long_description,
@@ -25,7 +29,6 @@ setup(
 
     license='GPLv3',
 
-    # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
     classifiers=[
         'Development Status :: 3 - Beta',
 
@@ -47,18 +50,20 @@ setup(
 
     package_data={
         'motioneye': [
-            'static/*',
+            'static/*.*',
             'static/*/*',
             'templates/*'
         ]
     },
 
-    data_files=[],
+    data_files=[
+        (os.path.join('share/%s' % name, root), [os.path.join(root, f) for f in files])
+                for (root, dirs, files) in os.walk('extra')
+    ],
 
     entry_points={
         'console_scripts': [
-            'motioneye=motioneye.motioneye:main',
+            'meyectl=motioneye.meyectl:main',
         ],
-    },
+    }
 )
-