From b01a4ea0749d329ad9726b8d6f0d2dc52e5db945 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Wed, 25 Jun 2014 21:25:19 +0300 Subject: [PATCH] smb mount point root is now configurable --- AUTHORS | 2 +- settings_default.py | 3 +++ src/smbctl.py | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index e50709cf2..be860ef41 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1 @@ -motionEye was written by Calin Crisan +Calin Crisan diff --git a/settings_default.py b/settings_default.py index d90f6bb6e..ba108a68a 100644 --- a/settings_default.py +++ b/settings_default.py @@ -35,6 +35,9 @@ # enable SMB shares (requires root) SMB_SHARES = False +# the directory where the SMB mounts will be created +SMB_MOUNT_ROOT = '/media' + # interval in seconds at which motionEye checks the SMB mounts MOUNT_CHECK_INTERVAL = 300 diff --git a/src/smbctl.py b/src/smbctl.py index 061824f0e..86ef65093 100644 --- a/src/smbctl.py +++ b/src/smbctl.py @@ -41,16 +41,17 @@ def make_mount_point(server, share, username): share = re.sub('[^a-zA-Z0-9]', '_', share).lower() if username: - mount_point = '/media/motioneye_%s_%s_%s' % (server, share, username) + mount_point = os.path.join(settings.SMB_MOUNT_ROOT, 'motioneye_%s_%s_%s' % (server, share, username)) else: - mount_point = '/media/motioneye_%s_%s' % (server, share) + mount_point = os.path.join(settings.SMB_MOUNT_ROOT, 'motioneye_%s_%s' % (server, share)) return mount_point def _is_motioneye_mount(mount_point): - return bool(re.match('^/media/motioneye_\w+$', mount_point)) + mount_point_root = os.path.join(settings.SMB_MOUNT_ROOT, 'motioneye_') + return bool(re.match('^' + mount_point_root + '\w+$', mount_point)) def list_mounts():