|
@@ -13,7 +13,7 @@ def make_tz_aware(dt, tz='UTC', is_dst=None):
|
|
|
tz = pytz.timezone(tz)
|
|
|
except AttributeError:
|
|
|
pass
|
|
|
- return tz.localize(dt, is_dst=is_dst)
|
|
|
+ return tz.localize(dt, is_dst=is_dst)
|
|
|
|
|
|
|
|
|
|
|
@@ -23,14 +23,14 @@ def main():
|
|
|
heap.push(Event(datetime.now()+timedelta(minutes=30, seconds=3), "Cachan", "descr Cachan"))
|
|
|
heap.push(Event(datetime.now()+timedelta(minutes=30, seconds=12), "université paris 7", "descr p7"))
|
|
|
gap = timedelta(minutes=30) # 30 minutes : time to check trafic before an event
|
|
|
-
|
|
|
+
|
|
|
list_event = get_events()
|
|
|
for event in list_event:
|
|
|
heap.push(event)
|
|
|
-
|
|
|
+
|
|
|
while True:
|
|
|
# TODO feed heap
|
|
|
-
|
|
|
+
|
|
|
# sleep the min between 1 minute and the next event - gap
|
|
|
next = timedelta(seconds=1) # TODO 1 minute
|
|
|
if not heap.empty():
|
|
@@ -42,7 +42,7 @@ def main():
|
|
|
# next event
|
|
|
if not heap.empty() and heap.top().date-datetime.now() < gap:
|
|
|
event = heap.pop()
|
|
|
- print(event.description + " at " + event.location + ", " + str(event.date))
|
|
|
+ print(str(event))
|
|
|
|
|
|
# get useful ids of sources for this location
|
|
|
ids_sources = source.from_location(event.location)
|