Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
EventGen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
chaotikum
EventGen
Commits
300e88ff
Commit
300e88ff
authored
1 year ago
by
Lukas Ruge
Browse files
Options
Downloads
Patches
Plain Diff
more structire, mor helper functions
parent
2873aa92
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bitsundbaeume-treffen.txt
+3
-3
3 additions, 3 deletions
bitsundbaeume-treffen.txt
eventgenutils.py
+19
-3
19 additions, 3 deletions
eventgenutils.py
main.py
+25
-20
25 additions, 20 deletions
main.py
with
47 additions
and
26 deletions
bitsundbaeume-treffen.txt
+
3
−
3
View file @
300e88ff
---
layout: [eventcal]
title:
"Bits und Bäume Lübeck - Treffen"
eventdate:
<EVENTSTART>
eventend:
<EVENTEND>
title: "Bits und Bäume Lübeck - Treffen"
eventdate: <EVENTSTART>
eventend: <EVENTEND>
#https://www.uuidgenerator.net/
uid: <UUID>
contact: yksflip@chaotikum.org
...
...
This diff is collapsed.
Click to expand it.
eventgenutils.py
+
19
−
3
View file @
300e88ff
...
...
@@ -60,10 +60,26 @@ def is_equal_month(_date_candidate):
return
False
def
is_january
(
_date_candidate
):
return
_date_candidate
.
month
==
1
def
is_march
(
_date_candidate
):
return
_date_candidate
.
month
==
3
def
is_june
(
_date_candidate
):
return
_date_candidate
.
month
==
6
def
is_september
(
_date_candidate
):
return
_date_candidate
.
month
==
9
def
is_november
(
_date_candidate
):
return
_date_candidate
.
month
==
11
def
is_december
(
_date_candidate
):
return
_date_candidate
.
month
==
12
def
replace_date_in_template
(
_template
,
_tag
,
_date
):
return
_template
.
replace
(
_tag
,
_date
.
strftime
(
"
%Y-%m-%d %H:%M:%S %z
"
))
...
...
@@ -91,11 +107,11 @@ def modify_template(_template, _start, _end):
return
_template
def
create_event
(
_name
,
_date
,
_
start_h
,
_
start_m
,
_
end_h
,
end_m
,
add_days
=
0
):
def
create_event
(
_name
,
_date
,
start_h
our
=
00
,
start_m
inute
=
00
,
end_h
our
=
23
,
end_m
inute
=
59
,
add_days
=
0
):
with
open
(
_name
+
"
.txt
"
)
as
f
:
_template
=
f
.
read
()
_start
=
cet
.
localize
(
_date
.
replace
(
hour
=
_
start_h
,
minute
=
_
start_m
,
second
=
00
))
_end
=
cet
.
localize
(
_date
.
replace
(
hour
=
_
end_h
,
minute
=
end_m
,
second
=
00
))
_start
=
cet
.
localize
(
_date
.
replace
(
hour
=
start_h
our
,
minute
=
start_m
inute
,
second
=
00
))
_end
=
cet
.
localize
(
_date
.
replace
(
hour
=
end_h
our
,
minute
=
end_m
inute
,
second
=
00
))
_end
+=
datetime
.
timedelta
(
days
=
add_days
)
_template
=
modify_template
(
_template
,
_start
,
_end
)
...
...
This diff is collapsed.
Click to expand it.
main.py
+
25
−
20
View file @
300e88ff
import
datetime
import
eventgenutils
as
utils
#################################################
# set true if you want to generate files for that event type
#################################################
OPENSPACE
=
True
# every wednesday 19:00 to 23:59:59 but not between (and including) 24.12 and 1.1
REINIGUNG
=
Fals
e
REINIGUNG
=
Tru
e
# wednesday from 09:00 to 18:00
PLENUM
=
Fals
e
PLENUM
=
Tru
e
# second thursday of the month, except in november, where it is the third
OSM
=
Fals
e
OSM
=
Tru
e
# vierter donnerstag in ungeraden monaten
BITSUNDBAEUME
=
Fals
e
# jeden zweiten Dienstag im Monat um 18:31
BITSUNDBAEUME
=
Tru
e
# jeden zweiten Dienstag im Monat um 18:31
... ich vermute mal nicht im Januar?
FFHLORGA
=
True
# jeden dritten Donnerstag im Monat 19:00 bis 22:00 Uhr
NOOK
=
True
# zweiter freitag im November (und der darauf folgende Sams
a
tag)
# zweiter freitag im November (und der darauf folgende Samstag)
FUENF_MIN_TERMINE
=
True
# üblicherweise am vierten Mittwoch im letzten monat des quartals außer dezember (also März, Juni, September)
# März wird ggf geschoben, wenn Ostern/Easterhegg dazwischen kommt...
#################################################
# Year to create events for
#################################################
YEAR
=
2024
# Change to generate for another year
def
is_open_space
(
_date_candidate
):
_md
=
_date_candidate
.
day
_mo
=
_date_candidate
.
month
if
_mo
==
1
and
_md
==
1
:
if
utils
.
is_january
(
_date_candidate
)
and
_md
==
1
:
return
False
if
_mo
==
12
and
_md
>
23
:
if
utils
.
is_december
(
_date_candidate
)
and
_md
>
23
:
return
False
if
not
utils
.
is_wednesday
(
_date_candidate
):
return
False
...
...
@@ -43,7 +49,7 @@ def is_plenum(_date_candidate):
def
is_reinigung
(
_date_candidate
):
if
utils
.
is
W
ednesday
(
_date_candidate
):
if
utils
.
is
_w
ednesday
(
_date_candidate
):
return
True
return
False
...
...
@@ -55,7 +61,7 @@ def is_osm(_date_candidate):
def
is_bits_und_baeume
(
_date_candidate
):
if
utils
.
is_nth_tuesday_of_month
(
_date_candidate
,
1
):
if
not
utils
.
is_january
(
_date_candidate
)
and
utils
.
is_nth_tuesday_of_month
(
_date_candidate
,
1
):
return
True
return
False
...
...
@@ -72,43 +78,42 @@ def is_nook(_date_candidate):
def
is_fuenf_min
(
_date_candidate
):
_mo
=
_date_candidate
.
month
if
_mo
==
3
or
_mo
==
6
or
_mo
==
9
:
if
utils
.
is_march
(
_date_candidate
)
or
utils
.
is_june
(
_date_candidate
)
or
utils
.
is_september
(
_date_candidate
):
if
utils
.
is_nth_wednesday_of_month
(
_date_candidate
,
4
):
return
True
return
False
def
create_open_space
(
_date
):
utils
.
create_event
(
"
openspace
"
,
_date
,
19
,
00
,
23
,
5
9
)
utils
.
create_event
(
"
openspace
"
,
_date
,
start_hour
=
1
9
)
def
create_plenum
(
_date
):
utils
.
create_event
(
"
plenum
"
,
_date
,
19
,
00
,
20
,
00
)
utils
.
create_event
(
"
plenum
"
,
_date
,
start_hour
=
19
,
end_hour
=
20
,
end_minute
=
00
)
def
create_reinigung
(
_date
):
utils
.
create_event
(
"
reinigung
"
,
_date
,
9
,
00
,
18
,
00
)
utils
.
create_event
(
"
reinigung
"
,
_date
,
start_hour
=
9
,
end_hour
=
18
,
end_minute
=
00
)
def
create_osm
(
_date
):
utils
.
create_event
(
"
osm
"
,
_date
,
19
,
00
,
22
,
00
)
utils
.
create_event
(
"
osm
"
,
_date
,
start_hour
=
19
,
end_hour
=
22
,
end_minute
=
00
)
def
create_bits_und_baeume
(
_date
):
utils
.
create_event
(
"
bitsundbaeume-treffen
"
,
_date
,
18
,
31
,
22
,
00
)
utils
.
create_event
(
"
bitsundbaeume-treffen
"
,
_date
,
start_hour
=
18
,
start_minute
=
31
,
end_hour
=
22
,
end_minute
=
00
)
def
create_ffhl
(
_date
):
utils
.
create_event
(
"
ffhl-orga
"
,
_date
,
18
,
00
,
22
,
00
)
utils
.
create_event
(
"
ffhl-orga
"
,
_date
,
start_hour
=
18
,
end_hour
=
22
,
end_minute
=
00
)
def
create_nook
(
_date
):
utils
.
create_event
(
"
nook
"
,
_date
,
17
,
00
,
22
,
59
,
add_days
=
1
)
utils
.
create_event
(
"
nook
"
,
_date
,
start_hour
=
17
,
end_hour
=
22
,
add_days
=
1
)
def
create_fuenf_min
(
_date
):
utils
.
create_event
(
"
5min
"
,
_date
,
20
,
00
,
21
,
59
)
utils
.
create_event
(
"
5min
"
,
_date
,
start_hour
=
20
,
end_hour
=
21
)
date_to_check
=
datetime
.
datetime
.
strptime
(
str
(
YEAR
)
+
"
-01-01
"
,
utils
.
date_format
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment