-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeorgiatech.py
65 lines (62 loc) · 1.85 KB
/
georgiatech.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import requests
import xmltodict
from collections import defaultdict
class GeorgiaTech(object):
def __init__(self):
# Calculate stop_coords
session = requests.Session()
session.headers.update({"User-Agent": "NextBuzz ([email protected])"})
try:
response = session.get("https://gtbuses.herokuapp.com/agencies/georgia-tech/routes")
routes = xmltodict.parse(response.text)["body"]["route"]
self.stop_coords = {}
for route in routes:
for stop in route["stop"]:
if not str(stop["@tag"]) in self.stop_names[str(stop["@title"])]:
self.stop_names[str(stop["@title"])].append(str(stop["@tag"]))
self.stop_coords[(route["@tag"], stop["@tag"])] = (float(stop["@lat"]), float(stop["@lon"]))
except:
print("You are offline - cannot load stop_coords")
# CONSTANTS
stop_coords = {} # Auto-populated
stop_names = defaultdict(list) # Auto-populated
all_routes = ["red", "blue", "green", "trolley", "night", "tech"]
route_colors = {
"red": "#FE1C00",
"green": "#0FCB66",
"blue": "#0F03FF",
"tech": "#FFFF00",
"trolley": "#CA8E20",
"night": "#774BA7"
}
mw_class_schedule = [
(480, 530),
(545, 595),
(610, 660),
(675, 725),
(740, 790),
(835, 885),
(900, 975),
(990, 1065),
(1080, 1155),
(1170, 1245)
]
tr_class_schedule = [
(480, 555),
(570, 645),
(720, 795),
(810, 885),
(900, 975),
(990, 1065),
(1080, 1155),
(1170, 1245)
]
f_class_schedule = [
(480, 530),
(545, 595),
(610, 660),
(675, 725),
(740, 790),
(835, 885),
(900, 1155)
]