remove all eagle stuff from nr.py

This commit is contained in:
jesopo 2019-11-26 13:37:30 +00:00
parent ed775ddbe3
commit 9eb51740b3

View file

@ -126,8 +126,6 @@ class Module(ModuleManager.BaseModule):
client = self.client client = self.client
colours = self.COLOURS colours = self.COLOURS
eagle_key = self.bot.config.get("eagle-api-key", None)
eagle_url = self.bot.config.get("eagle-api-url", None)
schedule = {} schedule = {}
location_code = event["args_split"][0].upper() location_code = event["args_split"][0].upper()
@ -237,16 +235,6 @@ class Module(ModuleManager.BaseModule):
trains.append(parsed) trains.append(parsed)
if eagle_url:
summary_query = utils.http.request("%s/json/summaries/%s?uids=%s" % (eagle_url, now.date().isoformat(), "%20".join([a["uid"] for a in trains])), json=True, headers={"x-eagle-key": self.bot.config["eagle-api-key"]})
if summary_query:
for t in trains:
summary = summary_query.data.get(t["uid"])
if summary:
t.update(summary)
summary_plat = summary.get("platforms", {}).get(query["crs"])
if summary_plat and t["platform"]=="?":
t["platform"], t["platform_prefix"] = summary_plat, "s"
for t in trains: for t in trains:
t["dest_summary"] = "/".join(["%s%s" %(a["code"]*filter["crs"] or a["name"], " " + a["via"] t["dest_summary"] = "/".join(["%s%s" %(a["code"]*filter["crs"] or a["name"], " " + a["via"]
@ -316,8 +304,6 @@ class Module(ModuleManager.BaseModule):
"S": "ship", "T": "trip", "1": "train", "2": "freight", "S": "ship", "T": "trip", "1": "train", "2": "freight",
"3": "trip", "4": "ship", "5": "bus"} "3": "trip", "4": "ship", "5": "bus"}
eagle_key = self.bot.config.get("eagle-api-key", None)
eagle_url = self.bot.config.get("eagle-api-url", None)
schedule = {} schedule = {}
sources = [] sources = []
@ -336,10 +322,6 @@ class Module(ModuleManager.BaseModule):
if len(service_id) <= 8: if len(service_id) <= 8:
query = client.service.QueryServices(service_id, datetime.utcnow().date().isoformat(), query = client.service.QueryServices(service_id, datetime.utcnow().date().isoformat(),
datetime.utcnow().time().strftime("%H:%M:%S+0000")) datetime.utcnow().time().strftime("%H:%M:%S+0000"))
if eagle_url:
schedule_query = utils.http.request("%s/json/schedule/%s/%s" % (eagle_url, service_id, datetime.now().date().isoformat()), json=True, headers={"x-eagle-key": eagle_key})
if schedule_query:
schedule = schedule_query.data["current"]
if not query and not schedule: if not query and not schedule:
return event["stdout"].write("No service information is available for this identifier.") return event["stdout"].write("No service information is available for this identifier.")