Created
July 27, 2024 17:15
-
-
Save prail/e03e78e883898290ad3e2b70383e59e2 to your computer and use it in GitHub Desktop.
Eagles Nest Class Calendar Filter/Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ICS file filter | |
BEGIN { | |
FS = ":" | |
buffer = "" | |
notevent = 0 | |
} | |
($1~/^BEGIN/ && $2~/VEVENT/) { | |
keep = 1; | |
} | |
($1~/^BEGIN/ && $2!~/VEVENT/) { | |
notevent = 1; | |
} | |
$1~/SUMMARY/ && notevent==0 { | |
if ($2~/[A-Z]{2} [0-9]{3}.+[0-9]+.*/) | |
{ | |
keep = 1; | |
} | |
else | |
{ | |
# clear the event buffer and inform not to keep whole record | |
buffer = ""; | |
keep = 0; | |
} | |
} | |
notevent==0 { | |
if (keep==1) | |
{ | |
buffer=buffer$0"\n" | |
} | |
} | |
($1~/^END/ && $2~/VEVENT/) { | |
if (keep == 1) | |
{ | |
printf("%s", buffer); | |
buffer = ""; | |
keep = 0; | |
} | |
} | |
($1~/^END/ && $2!~/VEVENT/) { | |
notevent = 0; | |
print $0; | |
} | |
notevent==1 { print $0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CALENDAR_URL="put_your_eagles_nest_calendar_url_here" | |
wget -q -O - "${CALENDAR_URL/webcal/http}" | awk -f ./class_filter.awk > class_calendar.ics |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment