This repository has been archived by the owner on Mar 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateTimetablesFromiCal.zsh
executable file
·67 lines (54 loc) · 2.09 KB
/
updateTimetablesFromiCal.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/zsh
# Get MPSMD2RES Lecture List, put into CSV,make Markdown table
includeEventProps="title, datetime, location, notes"
echo "Title,Room,Description,Date" > "$TEMPDIRECTORY/timetableLecture2res.csv"
icalBuddy \
-nnr " " \
-b "" \
--includeEventProps $includeEventProps --dateFormat "%edayMonthSeparator%b" \
--timeFormat "" \
--includeCals CCCU \
--propertySeparators "|,|" \
eventsFrom:2016-09-20 to:2017:05:02 \
| egrep 2RES \
| sed "s/ (CCCU)//g" \
| egrep "Lecture" \
| sed "s/MPSMD2RES Lecture: //g" \
| sed "s/location: //g" \
| sed "s/notes: //g" \
| sed "s/ Long description:.*,/,/" \
| sed "s/ -//g" \
| sed "s/dayMonthSeparator/\ /" \
>> "$TEMPDIRECTORY/timetableLecture2res.csv"
# Tidy it up:
cat "$TEMPDIRECTORY/timetableLecture2res.csv" | awk 'BEGIN { FS = "," }{print $1, "," $4, "," $2, "\\ \\ \\ \\ ," $3}' | sed "s/Room.*,/Room ,/" > "$TEMPDIRECTORY/timetableLecture2resColumnsReordered.csv"
# Create the markdown table
csvtomd "$TEMPDIRECTORY/timetableLecture2resColumnsReordered.csv" > "$HOME/Dropbox/CCCU/text/deploy/includes/timetableLecture2res.markdown"
# -----------------------------------------------------------------------------------
# Get MPSMD2RES Seminar List, put into CSV, make Markdown table
includeEventProps="title, datetime, notes"
echo "Title,Description,Date" > "$TEMPDIRECTORY/timetableSeminar2res.csv"
icalBuddy \
-nnr " " \
-b "" \
--timeFormat "" \
--includeEventProps "title, datetime, notes" \
--includeCals CCCU \
--dateFormat "%edayMonthSeparator%b" \
--propertySeparators "|@|" \
eventsFrom:2016-09-20 to:2017:05:02 \
| egrep 2RES \
| egrep "GRP1:" \
| sed "s/MPSMD2RES S GRP1: //g" \
| sed "s/notes: //g" \
| sed "s/ -//g" \
| sed "s/dayMonthSeparator/\ /" \
| sed "s/ (CCCU)//g" \
>> "$TEMPDIRECTORY/timetableWorkshop2res.csv"
# Create the markdown table
csvtomd -d "@" "$TEMPDIRECTORY/timetableWorkshop2res.csv" > "$HOME/Dropbox/CCCU/text/deploy/includes/timetableWorkshop2res.markdown"
# -----------------------------------------------------------------------------------
# Get deadlines for:
# 3ART, 3LAD
# 2RES
# 1BAM