mirror of
https://github.com/smittix/intercept.git
synced 2026-07-02 23:08:59 -07:00
feat: Auto-update TLE data on app startup
- Add refresh_tle_data() function for reusable TLE updates - Automatically fetch fresh TLE from CelesTrak when app starts - Runs in background thread to avoid slowing down startup - Includes NOAA-20 and NOAA-21 in name mappings - Gracefully handles failures (uses cached data if offline) - Existing /update-tle endpoint now uses shared function This ensures satellite tracking data is always fresh, fixing inaccurate positions caused by stale TLE data. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -714,6 +714,22 @@ def main() -> None:
|
||||
from routes import register_blueprints
|
||||
register_blueprints(app)
|
||||
|
||||
# Update TLE data in background thread (non-blocking)
|
||||
def update_tle_background():
|
||||
try:
|
||||
from routes.satellite import refresh_tle_data
|
||||
print("Updating satellite TLE data from CelesTrak...")
|
||||
updated = refresh_tle_data()
|
||||
if updated:
|
||||
print(f"TLE data updated for: {', '.join(updated)}")
|
||||
else:
|
||||
print("TLE update: No satellites updated (may be offline)")
|
||||
except Exception as e:
|
||||
print(f"TLE update failed (will use cached data): {e}")
|
||||
|
||||
tle_thread = threading.Thread(target=update_tle_background, daemon=True)
|
||||
tle_thread.start()
|
||||
|
||||
# Initialize WebSocket for audio streaming
|
||||
try:
|
||||
from routes.audio_websocket import init_audio_websocket
|
||||
|
||||
Reference in New Issue
Block a user