
import logging
import os.path
import sys

import motioneye

# the root directory of the project
PROJECT_PATH = os.path.dirname(motioneye.__file__)

# the templates directory
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'templates')

# the static files directory
STATIC_PATH = os.path.join(PROJECT_PATH, 'static')

# static files (.css, .js etc) are served at this root url;
# change this if you run motionEye behind a reverse proxy (e.g. nginx),
# and you want static files to be served directly by it
STATIC_URL = '/static/'

# path to the configuration directory (must be writable by motionEye)
CONF_PATH = [sys.prefix, ''][sys.prefix == '/usr']  + '/etc/motioneye'

# path to the directory where pid files go (must be writable by motionEye)
for d in ['/run', '/var/run', '/tmp', '/var/tmp']:
    if os.path.exists(d):
        RUN_PATH = d
        break
    
else:
    RUN_PATH = PROJECT_PATH

# path to the directory where log files go (must be writable by motionEye)
for d in ['/log', '/var/log', '/tmp', '/var/tmp']:
    if os.path.exists(d):
        LOG_PATH = d
        break
    
else:
    LOG_PATH = RUN_PATH

# default output path for media files (must be writable by motionEye)
MEDIA_PATH = RUN_PATH

# path to the motion binary to use (automatically detected by default)
MOTION_BINARY = None

# the log level (use FATAL, ERROR, WARNING, INFO or DEBUG)
LOG_LEVEL = logging.INFO

# the IP address to listen on
# (0.0.0.0 for all interfaces, 127.0.0.1 for localhost)
LISTEN = '0.0.0.0'

# the TCP port to listen on
PORT = 8765

# interval in seconds at which motionEye checks the SMB mounts
MOUNT_CHECK_INTERVAL = 300

# interval in seconds at which motionEye checks if motion is running
MOTION_CHECK_INTERVAL = 10

# interval in seconds at which the janitor is called
# to remove old pictures and movies
CLEANUP_INTERVAL = 43200

# interval in seconds at which the thumbnail mechanism runs
# (set to 0 to disable) 
THUMBNAILER_INTERVAL = 60

# timeout in seconds to wait for response from a remote motionEye server
REMOTE_REQUEST_TIMEOUT = 10

# timeout in seconds to wait for mjpg data from the motion daemon
MJPG_CLIENT_TIMEOUT = 10

# timeout in seconds after which an idle mjpg client is removed
# (set to 0 to disable)
MJPG_CLIENT_IDLE_TIMEOUT = 10

# enable SMB shares (requires motionEye to run as root) 
SMB_SHARES = False

# the directory where the SMB mount points will be created
SMB_MOUNT_ROOT = '/media'

# path to the wpa_supplicant.conf file
# (enable this to configure wifi settings from the UI)
WPA_SUPPLICANT_CONF = None

# path to the localtime file
# (enable this to configure the system time zone from the UI)
LOCAL_TIME_FILE = None

# enables shutdown and rebooting after changing system settings
# (such as wifi settings or time zone)
ENABLE_REBOOT = False

# timeout in seconds to use when talking to the SMTP server
SMTP_TIMEOUT = 60

# timeout in seconds to wait for zip file creation
ZIP_TIMEOUT = 500

# enable adding and removing cameras from UI
ADD_REMOVE_CAMERAS = True
