From eea1dff629225ff94fe5ffb4907ff43d19a62c4f Mon Sep 17 00:00:00 2001 From: Claude Pageau Date: Tue, 17 Oct 2023 18:40:14 -0400 Subject: [PATCH] ver 13.17 misc updates --- speed-cam.py | 34 +++++++++++++++------------------- speed-camera-docker-run.sh | 10 +++++----- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/speed-cam.py b/speed-cam.py index 128fccc..ecac65c 100644 --- a/speed-cam.py +++ b/speed-cam.py @@ -44,7 +44,7 @@ """ from __future__ import print_function -PROG_VER = "13.16" # current version of this python script +PROG_VER = "13.17" # current version of this python script print('Loading Wait...') import os import sys @@ -278,6 +278,20 @@ os.makedirs(DB_DIR_PATH) # make directory if Not Found DB_PATH = os.path.join(DB_DIR_PATH, DB_NAME) # Create path to db file +try: # Check to see if opencv is installed + import cv2 +except ImportError: + logging.error("Could Not import cv2 library") + if sys.version_info > (2, 9): + logging.error("python3 failed to import cv2") + logging.error("Try installing opencv for python3") + logging.error("For RPI See https://github.com/pageauc/opencv3-setup") + else: + logging.error("python2 failed to import cv2") + logging.error("Try running menubox.sh then UPGRADE menu pick.") + logging.error("%s %s Exiting Due to Error", PROG_NAME, PROG_VER) + sys.exit(1) + # Import a single variable from the search_config.py file # This is done to auto create a media/search directory try: @@ -352,24 +366,6 @@ logging.warning("%s" % err_msg) CAMERA_WIDTH, CAMERA_HEIGHT = IM_SIZE - -# import the necessary packages -# ----------------------------- - -try: # Check to see if opencv is installed - import cv2 -except ImportError: - logging.error("Could Not import cv2 library") - if sys.version_info > (2, 9): - logging.error("python3 failed to import cv2") - logging.error("Try installing opencv for python3") - logging.error("For RPI See https://github.com/pageauc/opencv3-setup") - else: - logging.error("python2 failed to import cv2") - logging.error("Try RPI Install per command") - logging.error("%s %s Exiting Due to Error", PROG_NAME, PROG_VER) - sys.exit(1) - # fix possible invalid values when resizing if CV_WINDOW_BIGGER < 0.1: CV_WINDOW_BIGGER = 0.1 diff --git a/speed-camera-docker-run.sh b/speed-camera-docker-run.sh index b0ce7eb..3fb1539 100644 --- a/speed-camera-docker-run.sh +++ b/speed-camera-docker-run.sh @@ -1,15 +1,15 @@ #!/bin/bash # Check if config.py is symlinked to docker volue -if [ ! -L /root/speed-camera/config.py ]; then +if [ ! -L /root/speed-camera/config.py ]; then echo "config.py not symlinked ..." if [ ! -f /root/speed-camera/config/config.py ]; then echo "config.py does not exist in the docker volume, let's move it there and create a symlink" mv /root/speed-camera/config.py /root/speed-camera/config/config.py - ln -fs /root/speed-camera/config/config.py /root/speed-camera/config.py + ln -fs /root/speed-camera/config/config.py /root/speed-camera/config.py else echo "config.py already exists on docker volume, so let's create a symlink" - ln -fs /root/speed-camera/config/config.py /root/speed-camera/config.py + ln -fs /root/speed-camera/config/config.py /root/speed-camera/config.py fi fi @@ -20,7 +20,7 @@ fi cd /root/speed-camera/ echo "Starting Web Server..." -python /root/speed-camera/webserver.py start >> /root/speed-camera/webserver.log 2>&1 & +/bin/bash /root/speed-camera/webserver.sh start echo "Starting Speed Camera..." -python3 /root/speed-camera/speed-cam.py start \ No newline at end of file +/bin/bash /root/speed-camera/speed-cam.sh start \ No newline at end of file