Update schedule and download script

This commit is contained in:
L3D 2024-10-30 22:08:56 +01:00
parent 33bb102695
commit 6f06075dfe
Signed by: L3D
GPG Key ID: CD08445BFF4313D1
2 changed files with 151 additions and 132 deletions

View File

@ -1,21 +1,28 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
"""
Script to Download Schedule
and rename rooms
"""
from pathlib import Path
import json
import os
import requests
# Schritt 1: Herunterladen der JSON-Datei
url = "https://talks.dhcp.cfhn.it/dhcp-2024/schedule/export/schedule.json"
response = requests.get(url)
URL = "https://talks.dhcp.cfhn.it/dhcp-2024/schedule/export/schedule.json"
response = requests.get(URL, timeout=23)
# Überprüfen, ob die Anfrage erfolgreich war
if response.status_code == 200:
schedule_data = response.json() # JSON-Daten laden
# Schritt 2: Ersetzen des Raum-Namens "A002 Hauptraum" durch "A002"
# pylint: disable=too-many-branches
def replace_room_names(data):
# Wenn data ein Wörterbuch ist, prüfen wir die Schlüssel und Werte
"""
Funktion zum Umbenennen der Namen
"""
if isinstance(data, dict):
# edit room value
keys_to_replace = {}
for key, value in data.items():
if value == "D002 Vortragsraum":
data[key] = "D002"
@ -25,20 +32,32 @@ if response.status_code == 200:
data[key] = "A017"
else:
replace_room_names(value)
# Wenn data eine Liste ist, gehen wir durch jedes Element
# edit room key
new_key = key
if key == "D002 Vortragsraum":
new_key = "D002"
elif key == "Haupteingang":
new_key = "Eingang"
elif key == "A017 Workshopraum":
new_key = "A017"
# and apply changes if needed
if new_key != key:
keys_to_replace[key] = new_key
for old_key, new_key in keys_to_replace.items():
data[new_key] = data.pop(old_key)
elif isinstance(data, list):
for item in data:
replace_room_names(item)
replace_room_names(schedule_data)
# Schritt 3: Speichern der geänderten Datei
output_path = "static/schedule.json"
os.makedirs(os.path.dirname(output_path), exist_ok=True)
with open(output_path, "w", encoding="utf-8") as f:
# save JSON
OUTPUT_PATH = Path("static/schedule.json")
OUTPUT_PATH.parent.mkdir(parents=True, exist_ok=True)
with OUTPUT_PATH.open("w", encoding="utf-8") as f:
json.dump(schedule_data, f, ensure_ascii=False, indent=4)
print("Die Datei wurde erfolgreich unter 'static/schedule.json' gespeichert.")
else:
print("Fehler beim Herunterladen der Datei:", response.status_code)

View File

@ -42,7 +42,7 @@
"day_start": "2024-10-31T04:00:00+01:00",
"day_end": "2024-11-01T03:59:00+01:00",
"rooms": {
"D002 Vortragsraum": [
"D002": [
{
"id": 37,
"guid": "dd47866a-01dc-5da7-b4a6-f491ada9a8b8",
@ -93,7 +93,7 @@
"abstract": "Kicking off the DHCP Capture the Flag contest",
"description": "",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 30,
@ -140,7 +140,7 @@
"answers": []
}
],
"Haupteingang": [
"Eingang": [
{
"id": 56,
"guid": "31b7ec1c-f212-5b4c-b7e6-768d7e270c43",
@ -159,7 +159,7 @@
"abstract": "Es wird irgend ein WOK gericht geben",
"description": "",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 3,
@ -182,7 +182,7 @@
"day_start": "2024-11-01T04:00:00+01:00",
"day_end": "2024-11-02T03:59:00+01:00",
"rooms": {
"D002 Vortragsraum": [
"D002": [
{
"id": 21,
"guid": "26b7c02b-0e13-50a6-b8cc-1a1fbf55463f",
@ -408,7 +408,7 @@
"answers": []
}
],
"A017 Workshopraum": [
"A017": [
{
"id": 32,
"guid": "da9b745f-e785-59f5-b27e-d46289df8ac2",
@ -459,7 +459,7 @@
"abstract": "In dem Workshop bauen wir gemeinsam ein Web-Frontend auf Basis von Vue. Dazu schauen wir uns nacheinander die verschiedenen Teilaspekte einer Vue-Anwendung an und setzen sie dann um.\r\nIhr solltet schon ein wenig Erfahrung mit Web-Technologien (HTML, CSS, JS) haben.",
"description": "### Ziel\r\n\r\nNach dem Workshop werdet ihr in der Lage sein, Web-Anwendungen mit Vue zu bauen.\r\n\r\n### Agenda\r\n\r\n- Kurzer Einstieg und Überblick von verschiedenen Render-Modellen\r\n- Einstieg in [Vue](https://vuejs.org/)\r\n- Geführtes entwickeln eines Vue-Frontends:\r\n - Vue Single File Components (Templates, Scripts und Styles)\r\n - Vue Reactivity Framework\r\n - Vue Composables\r\n- Überblick über das Vue Ecosystem",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 23,
@ -545,7 +545,7 @@
"answers": []
}
],
"Haupteingang": [
"Eingang": [
{
"id": 55,
"guid": "e7fcf551-5833-5d8b-97f0-e56c2c1aaf34",
@ -564,7 +564,7 @@
"abstract": "Es wird Pizza geben für Omnivor, Veggie and Vegan",
"description": "",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 16,
@ -587,7 +587,105 @@
"day_start": "2024-11-02T04:00:00+01:00",
"day_end": "2024-11-03T03:59:00+01:00",
"rooms": {
"D002 Vortragsraum": [
"Hackcenter": [
{
"id": 24,
"guid": "e6651b6a-fdaa-5f44-9f13-50068aa568d5",
"logo": "",
"date": "2024-11-02T13:00:00+01:00",
"start": "13:00",
"duration": "01:00",
"room": "Hackcenter",
"slug": "dhcp-2024-24-punkrock-yoga",
"url": "https://talks.dhcp.cfhn.it/dhcp-2024/talk/JK7BBY/",
"title": "Punkrock Yoga",
"subtitle": "",
"track": null,
"type": "Workshop",
"language": "de",
"abstract": "Wir starten mit ein paar entspannenden Yogaübungen zu guter Musik in einen weiteren chaotischen Partytag",
"description": "Zieht euch am besten etwas Bequemes an und bringt vielleicht eine weiche Unterlage mit. Wir werden einige Zeit am Boden liegend verbringen.",
"recording_license": "",
"do_not_record": false,
"persons": [
{
"id": 17,
"code": "TTG8QM",
"public_name": "haasmi",
"biography": "TBD",
"answers": []
}
],
"links": [],
"attachments": [],
"answers": []
},
{
"id": 46,
"guid": "0bdefc24-8ac0-5844-acc6-21dbd3ed4fb9",
"logo": "/media/dhcp-2024/submissions/9LUJGG/youWouldntDownloadAHouse_aSJvMlU_UU66zOw.png",
"date": "2024-11-02T22:00:00+01:00",
"start": "22:00",
"duration": "01:30",
"room": "Hackcenter",
"slug": "dhcp-2024-46-house",
"url": "https://talks.dhcp.cfhn.it/dhcp-2024/talk/9LUJGG/",
"title": "House",
"subtitle": "",
"track": null,
"type": "DJ-Set",
"language": "de",
"abstract": "Chill Stutter House :thumbsup: :thumbsup:",
"description": "Künstler: Fred again.., 49th & Main, Lavern",
"recording_license": "",
"do_not_record": false,
"persons": [
{
"id": 37,
"code": "MBCWLS",
"public_name": "Konsti",
"biography": "Professional cook. Do not request any Songs I do not have them, leave me alone :exclamationmark: :exclamationmark: :exclamationmark:",
"answers": []
}
],
"links": [],
"attachments": [],
"answers": []
},
{
"id": 42,
"guid": "9fdac370-012b-5757-b8e4-614509220a1e",
"logo": "/media/dhcp-2024/submissions/UFBM88/BassHouse_JVqkoIu.jpg",
"date": "2024-11-02T23:30:00+01:00",
"start": "23:30",
"duration": "01:00",
"room": "Hackcenter",
"slug": "dhcp-2024-42-house",
"url": "https://talks.dhcp.cfhn.it/dhcp-2024/talk/UFBM88/",
"title": "house",
"subtitle": "",
"track": null,
"type": "DJ-Set",
"language": "de",
"abstract": "Klassisches und Modernes Tech- und Bass House",
"description": "Klassisches und Mordernes Tech- und Bass House\r\nKünstler: Knock 2, ISOxo, Dillon Francis, Habstrakt, San Pancho\r\n\r\nKommt vorbei wird ein dickes Set! 👍",
"recording_license": "",
"do_not_record": true,
"persons": [
{
"id": 32,
"code": "ZUV7X7",
"public_name": "VPlus",
"biography": "Cool DJ. Come to my Set :thumbsup: :thumbsup:",
"answers": []
}
],
"links": [],
"attachments": [],
"answers": []
}
],
"D002": [
{
"id": 35,
"guid": "adb12cf5-aaae-57ff-9097-bc3a3e803138",
@ -709,7 +807,7 @@
"abstract": "When two hackers buy Iridium trackers on eBay and get more than they bargained for...",
"description": "How do you transmit data when theres 205,000 people trying to access the same mobile network in a field? Satellites, of course! After facing dilemmas of tracking the vehicles at a big UK festival, we decided to look at other options and discovered some cheap Iridium satellite constellation hardware on eBay. When they arrived, we surveyed what we had purchased, discovered it was ex-Ministry of Defense hardware, and hasnt been scrubbed properly. After getting a new pair of trousers and making the relevant disclosures, we worked to reverse engineer the hardware and get some usable data transmitting into space (and back down).\r\n\r\nThis involved dumping the firmware of the chip, and stepping bit-by-bit through the memory to understand what was happening, as well as a few casual emails to defence contractors. Getting airtime for satellite hardware was also a challenge, and working around the intricacies of Iridium Short Burst Data. Furthermore, weve developed the concept into an interactive map that overlays the realtime position of the tracker, and gives speed and heading data.",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 21,
@ -780,7 +878,7 @@
"abstract": "Nick und haasmi labern euch mit interessanten Geschichten zu. Bekannt aus dem Abendprogramm der FSCK.",
"description": "Wir kennen nun die Heilbronner schon etwas länger und haben mit denen ein paar Events gerissen dabei sind schon echt viele $Dinge passiert. Wir erzählen in gewohnter Weise,",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 17,
@ -802,7 +900,7 @@
"answers": []
}
],
"A017 Workshopraum": [
"A017": [
{
"id": 34,
"guid": "9d62d03a-45df-5969-b5b8-ba1fcb1d0ce3",
@ -860,7 +958,7 @@
"abstract": "Wir schauen uns zusammen die Programmiersprache Go an, und entwickeln unsere ersten kleinen Programme",
"description": "",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 2,
@ -939,105 +1037,7 @@
"answers": []
}
],
"Hackcenter": [
{
"id": 24,
"guid": "e6651b6a-fdaa-5f44-9f13-50068aa568d5",
"logo": "",
"date": "2024-11-02T13:00:00+01:00",
"start": "13:00",
"duration": "01:00",
"room": "Hackcenter",
"slug": "dhcp-2024-24-punkrock-yoga",
"url": "https://talks.dhcp.cfhn.it/dhcp-2024/talk/JK7BBY/",
"title": "Punkrock Yoga",
"subtitle": "",
"track": null,
"type": "Workshop",
"language": "de",
"abstract": "Wir starten mit ein paar entspannenden Yogaübungen zu guter Musik in einen weiteren chaotischen Partytag",
"description": "Zieht euch am besten etwas Bequemes an und bringt vielleicht eine weiche Unterlage mit. Wir werden einige Zeit am Boden liegend verbringen.",
"recording_license": "",
"do_not_record": false,
"persons": [
{
"id": 17,
"code": "TTG8QM",
"public_name": "haasmi",
"biography": "TBD",
"answers": []
}
],
"links": [],
"attachments": [],
"answers": []
},
{
"id": 46,
"guid": "0bdefc24-8ac0-5844-acc6-21dbd3ed4fb9",
"logo": "/media/dhcp-2024/submissions/9LUJGG/youWouldntDownloadAHouse_aSJvMlU_UU66zOw.png",
"date": "2024-11-02T22:00:00+01:00",
"start": "22:00",
"duration": "01:30",
"room": "Hackcenter",
"slug": "dhcp-2024-46-house",
"url": "https://talks.dhcp.cfhn.it/dhcp-2024/talk/9LUJGG/",
"title": "House",
"subtitle": "",
"track": null,
"type": "DJ-Set",
"language": "de",
"abstract": "Chill Stutter House :thumbsup: :thumbsup:",
"description": "Künstler: Fred again.., 49th & Main, Lavern",
"recording_license": "",
"do_not_record": false,
"persons": [
{
"id": 37,
"code": "MBCWLS",
"public_name": "Konsti",
"biography": "Professional cook. Do not request any Songs I do not have them, leave me alone :exclamationmark: :exclamationmark: :exclamationmark:",
"answers": []
}
],
"links": [],
"attachments": [],
"answers": []
},
{
"id": 42,
"guid": "9fdac370-012b-5757-b8e4-614509220a1e",
"logo": "/media/dhcp-2024/submissions/UFBM88/BassHouse_JVqkoIu.jpg",
"date": "2024-11-02T23:30:00+01:00",
"start": "23:30",
"duration": "01:00",
"room": "Hackcenter",
"slug": "dhcp-2024-42-house",
"url": "https://talks.dhcp.cfhn.it/dhcp-2024/talk/UFBM88/",
"title": "house",
"subtitle": "",
"track": null,
"type": "DJ-Set",
"language": "de",
"abstract": "Klassisches und Modernes Tech- und Bass House",
"description": "Klassisches und Mordernes Tech- und Bass House\r\nKünstler: Knock 2, ISOxo, Dillon Francis, Habstrakt, San Pancho\r\n\r\nKommt vorbei wird ein dickes Set! 👍",
"recording_license": "",
"do_not_record": false,
"persons": [
{
"id": 32,
"code": "ZUV7X7",
"public_name": "VPlus",
"biography": "Cool DJ. Come to my Set :thumbsup: :thumbsup:",
"answers": []
}
],
"links": [],
"attachments": [],
"answers": []
}
],
"Haupteingang": [
"Eingang": [
{
"id": 54,
"guid": "902a720f-02a9-55d9-8390-1788b00eb3a0",
@ -1088,7 +1088,7 @@
"abstract": "Es wird Maultaschenburger geben. In Omi, Veggie und Vegan",
"description": "",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 4,
@ -1111,7 +1111,7 @@
"day_start": "2024-11-03T04:00:00+01:00",
"day_end": "2024-11-04T03:59:00+01:00",
"rooms": {
"D002 Vortragsraum": [
"D002": [
{
"id": 40,
"guid": "b4e14549-03df-55bf-b9ae-4200d19e93be",
@ -1130,7 +1130,7 @@
"abstract": "Determining the winner of the DHCP24 Capture the Flag contest",
"description": "",
"recording_license": "",
"do_not_record": false,
"do_not_record": true,
"persons": [
{
"id": 30,