Skip to content

Commit

Permalink
ver 13.17 misc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pageauc committed Oct 17, 2023
1 parent ec168ea commit eea1dff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
34 changes: 15 additions & 19 deletions speed-cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions speed-camera-docker-run.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
/bin/bash /root/speed-camera/speed-cam.sh start

0 comments on commit eea1dff

Please sign in to comment.