Signed-off-by: encrypt <encrypt@labr.xyz>
@@ -44,7 +44,9 @@ def fetch_events(api_endpoint):
when += " alle "
when += end_hour
event['when'] = when
- event['media'][0]['thumbnailPosition'] = f"{(event['media'][0]['focalpoint'][0] + 1) * 50}% {(event['media'][0]['focalpoint'][1] + 1) * 50}%"
+ print(event)
+ if event['media']:
+ event['media'][0]['thumbnailPosition'] = f"{(event['media'][0]['focalpoint'][0] + 1) * 50}% {(event['media'][0]['focalpoint'][1] + 1) * 50}%"
return events
@app.route("/")
@@ -30,7 +30,7 @@
<div class="event">
<div class="center flyer-container">
- <img class="flyer" src="https://balotta.org/media/thumb/{{event.media[0].url}}" style="object-position: {{ event.media[0].thumbnailPosition }}"></img>
+ <img class="flyer" src="https://balotta.org/{{"media/thumb/" + event.media[0].url if event.media else "fallbackimage.png"}}" style="object-position: {{ event.media[0].thumbnailPosition if event.media else "50%"}}"></img>
</div>
<div class="event_info">
<h3 class="title">{{ event.title }}</h3>