Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events/freies hacken #74

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,65 @@ Markdown file '2024-11-06_n39_stammtisch.md' generated successfully in the _even
Markdown file '2024-11-27_n39_stammtisch.md' generated successfully in the _events folder!
Markdown file '2024-12-18_n39_stammtisch.md' generated successfully in the _events folder!
```

## Netz 39 Freies-Hacken Events erzeugen

```bash
cd tools
python3 generate_freieshacken_events.py <year>
```
Output:

```bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wollen wir diesen Output wirklich im Repo haben?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mir ist das egal, ich kann es auch einfach wieder löschen. Möchte nur verstehen, was dein Gedanke dahinter ist, das zu löschen, damit ich es fürs nächste Mal weiß 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich hab mich gefragt, was wir mit der Info im README machen - geht es darum, noch zu wissen, was dafür passiert ist? Dann würde ich die Info eher in die Commit-Message oder den PR schreiben.

Copy link
Contributor Author

@timherrm timherrm Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Für mich war es eher ein "so führst du es aus" und "das sollte dann dabei rauskommen, wenn alles funktioniert hat".
Hat für mich als Unwissender halt Sinn gemacht das da hin zu schreiben :D
Aber ja man sieht ja im Zweifel ob eine Fehlermeldung kommt oder Dateien in den Ordner geschrieben werden

Markdown file '2024-01-03_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-01-10_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-01-17_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-01-24_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-01-31_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-02-07_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-02-14_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-02-21_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-02-28_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-03-06_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-03-13_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-03-20_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-03-27_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-04-03_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-04-10_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-04-17_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-04-24_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-05-01_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-05-08_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-05-15_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-05-22_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-05-29_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-06-05_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-06-12_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-06-19_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-06-26_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-07-03_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-07-10_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-07-17_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-07-24_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-07-31_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-08-07_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-08-14_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-08-21_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-08-28_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-09-04_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-09-11_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-09-18_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-09-25_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-10-02_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-10-09_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-10-23_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-10-30_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-11-06_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-11-13_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-11-20_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-11-27_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-12-04_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-12-11_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-12-18_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
Markdown file '2024-12-25_n39_freies_hacken.md' generated successfully in the '../_events/2024/' folder!
```
62 changes: 62 additions & 0 deletions tools/generate_freies_hacken_events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os
import datetime
import sys

layout = "event"
title = "Freies Hacken"
event_description = f"""
**Wann: 19:30 Uhr**\\
**Wo: Netz39 e.V.**

Jeden Mittwoch treffen wir uns zum Basteln, Reparieren, Kochen und Ideen austauschen. Gäste sind gerne willkommen

Bitte beachtet, dass jede dritte Woche unser Stammtisch ist, wo wir über vereinsinterne Sachen reden und erst anschließend zum gemütlichen Abend übergehen.
"""
folder_name = "_events"
filename_prefix = "n39_freies_hacken"


# Function to generate the markdown content for a specific date
def generate_markdown_file(year, month, day):
markdown_content = f"""---
layout: {layout}
title: {title}
event_date: {year}-{month:02d}-{day:02d}
---
{event_description}
"""

folder_path = f"../{folder_name}/{year}/"
filename = f"{year}-{month:02d}-{day:02d}_{filename_prefix}.md"
file_path = os.path.join(folder_path, filename)

if not os.path.exists(folder_path):
os.makedirs(folder_path)

with open(file_path, 'w', encoding='utf-8') as file:
file.write(markdown_content)

print(f"Markdown file '{filename}' generated successfully in the '{folder_path}' folder!")


if len(sys.argv) < 2:
print(f"Usage: python3 {sys.argv[0]} <year>")
sys.exit()

# Get year from CLI
year = int(sys.argv[1])

# Calculate Wednesdays
for month in range(1, 13):
for day in range(1, 32):
try:
# Generate a date object
current_date = datetime.date(year, month, day)

# Check if the date is a Wednesday
if current_date.weekday() == 2:
generate_markdown_file(year, month, day)

except ValueError:
# If the day is out of range for the month, skip to the next month
pass