Commit a942544c authored by Pietro Saccardi's avatar Pietro Saccardi

Allowing the user to opt out of light plugin.

parent d0a8484d
......@@ -3,7 +3,7 @@ import logging
from misc.settings import SETTINGS
from plugins.decorators import get_all_plugins
from specialized import plugin_telegram, plugin_picamera, plugin_motion_detector, plugin_buffered_recorder, \
plugin_still, plugin_media_manager, plugin_status_led
plugin_still, plugin_media_manager, plugin_status_led, plugin_pwmled
import plugin_ratcam
from plugins.processes_host import ProcessesHost
from misc.logging import ensure_logging_setup
......@@ -26,9 +26,12 @@ def main(args):
assert plugin_motion_detector.MOTION_DETECTOR_PLUGIN_NAME in plugins
assert plugin_still.STILL_PLUGIN_NAME in plugins
assert plugin_ratcam.RATCAM_PLUGIN_NAME in plugins
assert plugin_pwmled.PWMLED_PLUGIN_NAME in plugins
assert plugin_status_led.STATUS_LED_PLUGIN_NAME in plugins
if not args.camera:
del plugins[plugin_picamera.PICAMERA_ROOT_PLUGIN_NAME]
if not args.light:
del plugins[plugin_pwmled.PWMLED_PLUGIN_NAME]
logging.info('Running the following plugins: ' + ', '.join(plugins.keys()))
# Ignore KeyboardInterrupt. If we don't do so, it will be raised also in the child processes. We do not have control
# over the threads running in the child processes, so they will terminate, and here we get some network exception
......@@ -43,8 +46,10 @@ def main(args):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--token', '-t', required=False, help='Telegram chat token.')
parser.add_argument('--no-cam', '--no-camera', '-nc', '-n', required=False, dest='camera', default=True,
parser.add_argument('--no-cam', '--no-camera', '-nc', required=False, dest='camera', default=True,
action='store_false', help='Skip initializing camera plugin.')
parser.add_argument('--no-light', '-nl', required=False, dest='light', default=True, action='store_false',
help='Skip PWM controlled led light.')
parser.add_argument('--verbose', '-v', required=False, default=False, action='store_true',
help='Log up to debug level')
main(parser.parse_args())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment