31 lines
640 B
Python
31 lines
640 B
Python
import sys
|
|
import logging
|
|
from reocon.cameras import get_camera_infos_df
|
|
from reocon.dashboard import app
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)s] %(message)s",
|
|
handlers=[logging.StreamHandler()]
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def run_console():
|
|
logger.info("Running in console mode")
|
|
df = get_camera_infos_df()
|
|
print(df.to_string(index=False))
|
|
|
|
|
|
def run_web():
|
|
logger.info("Starting Flask web dashboard")
|
|
app.run(debug=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) > 1 and sys.argv[1] == "console":
|
|
run_console()
|
|
else:
|
|
run_web()
|