diff --git a/5min.txt b/5min.txt new file mode 100644 index 0000000000000000000000000000000000000000..08ded1eace16ccc506a528fafe90e879104a9cd1 --- /dev/null +++ b/5min.txt @@ -0,0 +1,18 @@ +--- +layout: [eventcal] +title: "5 Minuten Termine" +eventdate: <EVENTSTART> +eventend: <EVENTEND> +#https://www.uuidgenerator.net/ +uid: <UUID> +contact: info@chaotikum.org +stream: tbd +recording: true +locations: + - Augenprüfraum +sets: + - kofferblau +short: "Du hast 300 Sekunden: Was ist dein Thema?" +--- + + diff --git a/main.py b/main.py index 2bab4395c8a7a2b05657c08c7ca5e92ffb3fa1e5..659bee622a7465ad76b18d616c71a14ae0f67b44 100644 --- a/main.py +++ b/main.py @@ -22,10 +22,18 @@ OSM = False BITSUNDBAEUME = False # jeden zweiten Dienstag im Monat um 18:31 -#Freifunk Lübeck -FFHLORGA = True +# Freifunk Lübeck +FFHLORGA = False # jeden dritten Donnerstag im Monat 19:00 bis 22:00 Uhr +# Nook +NOOK = False +# zweiter freitag im Npvember (und der darauf folgende samsatag) + +# Fünf Minuten Termine +FUENF_MIN_TERMINE = True +# üblicherweise am vierten Mitwoch im letzten monat des quartals außer dezember (also März, Juni, September) + year = 2024 start_date_string = str(year) + "-01-01" end_date_string = str(year) + "-12-31" @@ -82,10 +90,19 @@ def is_nth_tuesday_of_month(_date_candidate, _n): return is_nth_xday_of_month(_date_candidate, _date_candidate.year, _date_candidate.month, _n, 1) +def is_nth_wednesday_of_month(_date_candidate, _n): + return is_nth_xday_of_month(_date_candidate, _date_candidate.year, _date_candidate.month, _n, 2) + + +def is_nth_friday_of_month(_date_candidate, _n): + return is_nth_xday_of_month(_date_candidate, _date_candidate.year, _date_candidate.month, _n, 4) + + def is_plenum(_date_candidate): - if not mo == 11 and is_nth_thursday_of_month(_date_candidate, 2): + _mo = _date_candidate.month + if not _mo == 11 and is_nth_thursday_of_month(_date_candidate, 2): return True - if mo == 11 and is_nth_thursday_of_month(_date_candidate, 3): + if _mo == 11 and is_nth_thursday_of_month(_date_candidate, 3): return True return False @@ -99,15 +116,12 @@ def is_reinigung(_date_candidate): def is_osm(_date_candidate): _mo = _date_candidate.month - _year = _date_candidate.year if _mo % 2 == 1 and is_nth_thursday_of_month(_date_candidate, 4): return True return False def is_bits_und_baeume(_date_candidate): - _year = _date_candidate.year - _mo = _date_candidate.month if is_nth_tuesday_of_month(_date_candidate, 1): return True return False @@ -118,6 +132,21 @@ def is_ffhl(_date_candidate): return True return False + +def is_nook(_date_candidate): + _mo = _date_candidate.month + if _mo == 11 and is_nth_friday_of_month(_date_candidate, 2): + return True + + +def is_fuenf_min(_date_candidate): + _mo = _date_candidate.month + if _mo == 3 or _mo == 6 or _mo == 9: + if is_nth_wednesday_of_month(_date_candidate, 4): + return True + return False + + def replace_date_in_template(_template, _tag, _date): return _template.replace(_tag, _date.strftime("%Y-%m-%d %H:%M:%S %z")) @@ -134,6 +163,10 @@ def set_uuid(_template, _uuid): return _template.replace("<UUID>", str(_uuid)) +def set_year(_template, _year): + return _template.replace("<YEAR>", str(_year)) + + def create_open_space(_date): with open('openspace.txt') as f: _openspace_template = f.read() @@ -217,7 +250,7 @@ def create_ffhl(_date): with open('ffhl-orga.txt') as f: _ffhl_orga_template = f.read() - _start = cet.localize(_date.replace(hour=18, minute=31, second=00)) + _start = cet.localize(_date.replace(hour=18, minute=00, second=00)) _end = cet.localize(_date.replace(hour=22, minute=00, second=00)) _ffhl_orga_template = set_start_date(_ffhl_orga_template, _start) @@ -228,6 +261,41 @@ def create_ffhl(_date): with open("created/" + filename, 'w') as out: out.write(_ffhl_orga_template) + +def create_nook(_date): + with open('nook.txt') as f: + _nook_template = f.read() + + _start = cet.localize(_date.replace(hour=17, minute=00, second=00)) + _end = cet.localize(_date.replace(hour=22, minute=59, second=00)) + _end += datetime.timedelta(days=1) # nnok has two days + + _nook_template = set_start_date(_nook_template, _start) + _nook_template = set_end_date(_nook_template, _end) + _nook_template = set_uuid(_nook_template, uuid.uuid4()) + _nook_template = set_year(_nook_template, _start.year) + + filename = _start.strftime("%Y-%m-%d") + "-nook.md" + with open("created/" + filename, 'w') as out: + out.write(_nook_template) + + +def create_fuenf_min(_date): + with open('5min.txt') as f: + _5min_template = f.read() + + _start = cet.localize(_date.replace(hour=20, minute=00, second=00)) + _end = cet.localize(_date.replace(hour=21, minute=59, second=00)) + + _5min_template = set_start_date(_5min_template, _start) + _5min_template = set_end_date(_5min_template, _end) + _5min_template = set_uuid(_5min_template, uuid.uuid4()) + + filename = _start.strftime("%Y-%m-%d") + "-5min.md" + with open("created/" + filename, 'w') as out: + out.write(_5min_template) + + date_to_check = start_date while date_to_check <= end_date: if OPENSPACE: @@ -254,5 +322,13 @@ while date_to_check <= end_date: result = is_ffhl(date_to_check) if result: create_ffhl(date_to_check) + if NOOK: + result = is_nook(date_to_check) + if result: + create_nook(date_to_check) + if FUENF_MIN_TERMINE: + result = is_fuenf_min(date_to_check) + if result: + create_fuenf_min(date_to_check) date_to_check += datetime.timedelta(days=1) diff --git a/nook.txt b/nook.txt new file mode 100644 index 0000000000000000000000000000000000000000..39d7c8d18deb759665bd145f8e98ea5970da764e --- /dev/null +++ b/nook.txt @@ -0,0 +1,17 @@ +--- +layout: [eventcal] +title: "NooK <YEAR>" +eventdate: <EVENTSTART> +eventend: <EVENTEND> +#https://www.uuidgenerator.net/ +uid: <UUID> +contact: contact@nook-luebeck.de +organizer: NooK Orga +recording: true +stream: https://<YEAR>.nook-luebeck.de/live +locations: + - Audimax Uni Lübeck +sets: + - leihbar +short: "Zweitägige Konferenz auf dem Campus der Uni Lübeck mit vielen Vorträgen, Ständen, Kunst und spannenden Themen." +---