diff --git a/satnogs.py b/satnogs.py index 3725aaf..0626b2b 100644 --- a/satnogs.py +++ b/satnogs.py @@ -1,9 +1,9 @@ from datetime import datetime , timedelta import requests from tqdm import tqdm -from flask import Flask , render_template,redirect,url_for +from flask import Flask , render_template,redirect,url_for, request import json -from collections import defaultdict +from collections import defaultdict, Counter import random from apscheduler.schedulers.background import BackgroundScheduler from satnogs_api_client import fetch_satellites, DB_BASE_URL,fetch_tle_of_observation ,get_paginated_endpoint @@ -18,6 +18,8 @@ ts = load.timescale() broken = defaultdict(set) + +Usage = Counter() Sats = defaultdict(list) Passes = defaultdict(list) Stations = [] @@ -184,6 +186,7 @@ def updateCZML(): temp = temp+timedelta(minutes=1) sat["position"]["interpolationAlgorithm"] = "LAGRANGE" sat["position"]["interpolationDegree"] = 5 +# sat["position"]["referenceFrame"] = "INERTIAL" sat["position"]["epoch"] = (y["start"].isoformat()+"Z").replace("+00:00","") sat["path"] = {"show":{"interval":(y["start"].isoformat()+"Z").replace("+00:00","")+"/"+((y["end"]+timedelta(minutes=1)).isoformat()+"Z").replace("+00:00",""),"boolean":True},"width":2,"material":{"solidColor":{"color":{"rgba":[0,255,0,255]}}},"leadTime":100000,"trailTime":100000 } @@ -199,10 +202,20 @@ def updateCZML(): @app.route("/") def index(): + + Usage.update([str(request.headers.get("CF-IPCountry"))]) return render_template("index.html",url="/czml") + + +@app.route("/rotating") +def index(): + + Usage.update([str(request.headers.get("CF-IPCountry"))]) + return render_template("rotating.html",url="/czml") @app.route("/station/") def index_station(station_id): + Usage.update(request.headers.get("CF-IPCountry")) return render_template("index.html",url="/czml/"+str(station_id)) @@ -220,10 +233,13 @@ def api_broken(): output = defaultdict(list) for x in broken.keys(): output[x]=list(broken[x]) - - return json.dumps(output) +@app.route("/usage") +def usage(): + return json.dumps(Usage) + + @app.route("/czml/") def api_station(station_id): czml = [] diff --git a/satnogs_api_client.pyc b/satnogs_api_client.pyc index 3613028..d18a884 100644 Binary files a/satnogs_api_client.pyc and b/satnogs_api_client.pyc differ diff --git a/templates/index.html b/templates/index.html index f556a48..246b941 100644 --- a/templates/index.html +++ b/templates/index.html @@ -27,7 +27,13 @@ viewer.clock.shouldAnimate = true - + setInterval(function(){ + viewer.dataSources.removeAll() + viewer.dataSources.add(Cesium.CzmlDataSource.load("{{ url }}")) + + +}, 1000*60*60); + diff --git a/templates/rotating.html b/templates/rotating.html new file mode 100644 index 0000000..7372a07 --- /dev/null +++ b/templates/rotating.html @@ -0,0 +1,67 @@ + + + + + + + + + + +
+ + + +Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License