Rename main.py to api.py and minor changes

This commit is contained in:
30hours 2024-02-11 03:03:23 +00:00
parent d379e4073c
commit 32401c9031
4 changed files with 23 additions and 6 deletions

View file

@ -10,7 +10,7 @@ RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000 EXPOSE 5000
# define environment variable # define environment variable
ENV FLASK_APP=main.py ENV FLASK_APP=api.py
# run Gunicorn instead of the default Flask development server # run Gunicorn instead of the default Flask development server
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "main:app"] CMD ["gunicorn", "--bind", "0.0.0.0:5000", "main:app"]

View file

@ -1,4 +1,8 @@
# main.py """
@file api.py
@brief API for 3lips.
@author 30hours
"""
from flask import Flask, Response, render_template, request, redirect, jsonify, send_from_directory from flask import Flask, Response, render_template, request, redirect, jsonify, send_from_directory
import os import os

View file

@ -7,8 +7,9 @@ class AdsbAssociator:
""" """
@class AdsbAssociator @class AdsbAssociator
@brief A class for associating a detection with ADS-B truth. @brief A class for associating detections of the same target.
@details Uses radar detection data from a blah2 server. @details Girst associate ADS-B truth with each radar detection.
Then associate over multiple radars.
@see blah2 at https://github.com/30hours/blah2. @see blah2 at https://github.com/30hours/blah2.
Uses truth data in delay-Doppler space from an adsb2dd server. Uses truth data in delay-Doppler space from an adsb2dd server.
@see adsb2dd at https://github.com/30hours/adsb2dd. @see adsb2dd at https://github.com/30hours/adsb2dd.

View file

@ -81,9 +81,21 @@ async def event():
# main processing # main processing
for item in api_event: for item in api_event:
for radar in item["server"]: # associator selection
if item["associator"] == "adsb-associator":
associator = adsbAssociator
else:
print("Error: Associator invalid.")
return
print(radar, flush=True) # coord reg selection
if item["coordreg"] == "ellipse-parametric":
coordreg = ellipseParametric
else:
print("Error: Coord reg invalid.")
return
print(radar, flush=True)
# delete old API requests # delete old API requests
api_event = [ api_event = [