commit 5ff5f0149797fa4a5e3ab0d334bd59bd06923bbe
parent f3c04582de01729470494a26823248f347441c27
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 28 Apr 2020 11:50:27 +0200
Handle ics invites without timezone, parse location info
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/.local/bin/plumb b/.local/bin/plumb
@@ -74,16 +74,18 @@ annotate_date_string() {
}
handle_calendar_invite() {
- starttime="$(grep -E "DTSTART.*TZID" "$1" | sed 's/.*://' | \
+ starttime="$(grep -E "DTSTART.*" "$1" | sed 's/.*://' | \
annotate_date_string )"
- endtime="$(grep -E "DTEND.*TZID" "$1" | sed 's/.*://' | \
+ endtime="$(grep -E "DTEND.*" "$1" | sed 's/.*://' | \
annotate_date_string )"
tzone="$(grep -E "DTEND.*TZID" "$1" | sed 's/.*TZID=\(.*\):.*/\1/' )"
summary="$(grep -E "SUMMARY.*:" "$1" | sed 's/.*: *//' )"
+ location="$(grep -E "LOCATION.*:" "$1" | sed 's/.*: *//' )"
printf 'start time: %s\n' "$starttime"
printf 'end time: %s\n' "$endtime"
printf 'time zone: %s\n' "$tzone"
+ printf 'location: %s\n' "$location"
printf 'summary: %s\n' "$summary"
printf 'add to calendar? [y/N] '
@@ -102,9 +104,9 @@ handle_calendar_invite() {
sed 's/.* \([0-2][0-9]\):[0-5][0-9].*/\1/')"
min_end="$(printf '%s' "$endtime" | \
sed 's/.* [0-2][0-9]:\([0-5][0-9]\).*/\1/')"
- printf '%s/%s\t%s:%s-%s:%s %s (%s)\n' "$month" "$day" \
+ printf '%s/%s\t%s:%s-%s:%s %s (%s, %s)\n' "$month" "$day" \
"$hour_start" "$min_start" "$hour_end" "$min_end" \
- "$summary" "$tzone" \
+ "$summary" "$location" "$tzone"\
>> "$calendar"
rsync "$calendar" adamsgaard.dk:~/.calendar
upload "$calendar" >/dev/null;;