diff --git a/build_deb.sh b/build_deb.sh index a4d8e60..a07abf2 100755 --- a/build_deb.sh +++ b/build_deb.sh @@ -34,7 +34,7 @@ fpm -s python --python-bin python3 --python-pip pip3 --python-package-name-prefi -d "python3-pigpio" \ -d "python3-numpy" \ -d "ffmpeg" \ - -v 0.2.3-1 -t deb setup.py + -v 0.2.4-0 -t deb setup.py # --deb-changelog changelog \ # --deb-upstream-changelog changelog \ diff --git a/compLib/VisionDaemon.py b/compLib/VisionDaemon.py index 2f7def8..1c285da 100644 --- a/compLib/VisionDaemon.py +++ b/compLib/VisionDaemon.py @@ -1,21 +1,38 @@ import os +import socket import threading import time import systemd.daemon -import LogstashLogging -from LogstashLogging import logstash_logger -from threading import Thread -import logging -import socket + +try: + from compLib.LogstashLogging import Logging +except Exception as e: + import logging + + + class Logger(): + def __init__(self): + self.logger = logging.Logger('compApi background') + + def get_logger(self): + return self.logger + + Logging = Logger() + print(f"Could not import compLib.LogstashLogging: {str(e)}") + Logging.get_logger().error(f"Could not import compLib.LogstashLogging: {str(e)}") + +print("after basic imports") RUN_IP_CHECK = False try: from compLib.Display import Display from compLib.Spi import Spi except Exception as e: - logstash_logger.warning(f"Could not import display or spi for ip output {str(e)}") + print(f"Could not import display or spi for ip output {str(e)}") + Logging.get_logger().warning(f"Could not import display or spi for ip output {str(e)}") +print(f"After display and Spi import") __run = """raspivid -t 0 -b 5000000 -w 1280 -h 720 -fps 30 -n -o - | gst-launch-1.0 fdsrc ! video/x-h264,width=1280,height=720,framerate=30/1,noise-reduction=1,profile=high,stream-format=byte-stream ! h264parse ! queue ! flvmux streamable=true ! rtmpsink location=\"rtmp://localhost/live/stream\"""" @@ -38,7 +55,8 @@ def get_ip(): def write_ip_to_screen(): while not os.getenv("IP_OUTPUT", "false") == "false": ip = str(get_ip()) - logstash_logger.info(f"writing {ip} to display") + print(f"writing {ip} to display") + Logging.get_logger().info(f"writing {ip} to display") Display.write(1, ip) time.sleep(60) @@ -47,28 +65,35 @@ if __name__ == '__main__': try: systemd.daemon.notify(systemd.daemon.Notification.READY) except: - logstash_logger.warning("Warning, old systemd version detected") + Logging.get_logger().warning("Warning, old systemd version detected") systemd.daemon.notify('READY=1') - logstash_logger.info("starting ip output") + print("starting ip output") + Logging.get_logger().info("starting ip output") ip_output = None if RUN_IP_CHECK and IP_OUTPUT: try: Spi.disable_health_check() ip_output = threading.Thread(target=write_ip_to_screen) ip_output.start() - logstash_logger.info("starting ip output - DONE") + print("starting ip output - DONE") + Logging.get_logger().info("starting ip output - DONE") except Exception as e: - logstash_logger.error(f"could not start ip output -> {str(e)}") + print(f"could not start ip output -> {str(e)}") + Logging.get_logger().error(f"could not start ip output -> {str(e)}") if STREAM_RASPI: - logstash_logger.info("starting gstreamer background process") + print("starting gstreamer background process") + Logging.get_logger().info("starting gstreamer background process") os.system(__run) - logstash_logger.error("gstreamer stopped...") + print("gstreamer stopped...") + Logging.get_logger().error("gstreamer stopped...") else: - logstash_logger.info("not starting gstreamer background process and only checking for battery") + print("not starting gstreamer background process and only checking for battery") + Logging.get_logger().info("not starting gstreamer background process and only checking for battery") if ip_output is not None: ip_output.join() else: - logstash_logger.info("ip display output failed to initialize.. sleeping for a day, good night") - time.sleep(60*60*24) + print("ip display output failed to initialize.. sleeping for a day, good night") + Logging.get_logger().info("ip display output failed to initialize.. sleeping for a day, good night") + time.sleep(60 * 60 * 24) diff --git a/compLib/__init__.py b/compLib/__init__.py index 32b824f..1323bff 100644 --- a/compLib/__init__.py +++ b/compLib/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.2.3-1" +__version__ = "0.2.4-0" import importlib import compLib.LogstashLogging diff --git a/setup.py b/setup.py index 451ae11..7c4c025 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ else: setuptools.setup( name="complib", - version="0.2.3-1", + version="0.2.4-0", author="F-WuTs", author_email="--", description="",