Compare commits

...

2 Commits

2 changed files with 5 additions and 5 deletions

View File

@ -161,11 +161,11 @@ class AlertsModule:
align = self.draw_alert(alert, width, image, draw, fnt_R, fnt_B, align, font_size)
except BaseException as e:
logging.exception(e)
self.alerts.append({
align = self.draw_alert({
"title": "Impossible de générer les alertes de " + alert.__name__,
"description": type(e).__name__ + ": " + (e.message if hasattr(e, 'message') else str(e)),
"icon": "wi-earthquake.png",
})
}, width, image, draw, fnt_R, fnt_B, align, font_size)
else:
align = self.draw_alert(alert, width, image, draw, fnt_R, fnt_B, align, font_size)

View File

@ -245,7 +245,7 @@ class IcalModule:
now = time.mktime(datetime.now(tz=pytz.timezone('Europe/Paris')).timetuple())
coming = time.mktime((datetime.now(tz=pytz.timezone('Europe/Paris')) + timedelta(minutes=self.delayed_departure)).timetuple())
for evt in self.get_events(config):
for evt in self.get_events(config, toofar=datetime.fromtimestamp(coming, tz=pytz.timezone('Europe/Paris'))):
# Looking only the first event
start = time.mktime(evt["start"].timetuple())
return now < start and start < coming
@ -255,7 +255,7 @@ class IcalModule:
now = time.mktime(datetime.now(tz=pytz.timezone('Europe/Paris')).timetuple())
coming = time.mktime((datetime.now(tz=pytz.timezone('Europe/Paris')) + timedelta(minutes=self.delayed_departure)).timetuple())
for evt in self.get_events(config):
for evt in self.get_events(config, toofar=datetime.fromtimestamp(coming, tz=pytz.timezone('Europe/Paris'))):
if "location" in evt and (
evt["location"].lower().startswith("http") or
evt["location"].lower().startswith("ici") or
@ -273,7 +273,7 @@ class IcalModule:
now = time.mktime((datetime.now(tz=pytz.timezone('Europe/Paris')) + timedelta(minutes=self.delayed_departure/3)).timetuple())
coming = time.mktime((datetime.now(tz=pytz.timezone('Europe/Paris')) + timedelta(minutes=self.delayed_departure/3)).timetuple())
for evt in self.get_events(config):
for evt in self.get_events(config, toofar=datetime.fromtimestamp(coming, tz=pytz.timezone('Europe/Paris'))):
if not("location" in evt and evt["location"].lower().startswith("ici")):
continue