renamed /getMeteoroid to /getMeteoroids

small corrections in ip daemon
This commit is contained in:
Joel Klimont 2021-10-06 00:19:58 +02:00
parent 89d681d10f
commit 436ef35d46
7 changed files with 30 additions and 16 deletions

View file

@ -1,14 +1,13 @@
import os
import queue
from queue import Queue
import socket
import threading
import cv2
import logging
import threading
from compLib.LogstashLogging import Logging
from flask import Flask, Response
from compLib.LogstashLogging import Logging
RTMP_SERVER = os.getenv("RTMP_SERVER", "rtmp://localhost/live/stream")
SERVE_VIDEO = os.getenv("SERVER_SRC", "/live")
BUILDING_DOCS = os.getenv("BUILDING_DOCS", "false")
@ -161,6 +160,18 @@ def __index():
return HTML
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(('10.255.255.255', 1))
IP = s.getsockname()[0]
except Exception:
IP = '127.0.0.1'
finally:
s.close()
return IP
def __start_flask():
"""
Function for running flask server in a thread.
@ -169,6 +180,9 @@ def __start_flask():
"""
Logging.get_logger().info("starting flask server")
app.run(host="0.0.0.0", port=9898, debug=True, threaded=True, use_reloader=False)
ip = get_ip()
Logging.get_logger().info(f"Vision stream started and can be viewed on: {ip}:9898")
print(f"\033[92mVision stream started and can be viewed on: {ip}:9898\033[0m")
if BUILDING_DOCS == "false":