diff --git a/README.adoc b/README.adoc index 92e9ff2..efc15c1 100644 --- a/README.adoc +++ b/README.adoc @@ -47,8 +47,10 @@ into entries like that: ``` BEGIN:VEVENT -DTSTART:20191001T130000+0200 -DTEND:20191001T150000+0200 +UID:20191001T110000Z/epsi2ics/YOUR.LOGIN@HOSTNAME +DTSTAMP:20191001T184200Z +DTSTART:20191001T110000Z +DTEND:20191001T130000Z SUMMARY:HTLM5 / CSS3 LOCATION:N202(HEP Nantes) DESCRIPTION:🗣 teacher name 👥 class-group name diff --git a/epsiEDTtoICS.sh b/epsiEDTtoICS.sh index e7b3fe5..76ca085 100755 --- a/epsiEDTtoICS.sh +++ b/epsiEDTtoICS.sh @@ -3,6 +3,9 @@ # Copyright © 2019 Y. Gablin, under the GPL-3.0-or-later license. # Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing. # +# This script only works when executed in the timezone of the calendar, and only if this timezone offset +# is low enough to keep all events in the day they belong to in the web calendar (usually −6h ≤ TZ ≤ +8h). +# # from EPSI “edtmobilityeng” to ICS, for the current school year # $1: EPSI Login (firstname.lastname) # $2: output file (else standard output) @@ -12,6 +15,7 @@ if [ -n "$2" -a -d "$(dirname "$2")" -a -w "$(dirname "$2")" ]; then fi ( + dtstamp=$(date -u +%Y%m%dT%H%M%SZ) currentYear=$(date +%Y) splitDay=$(date +%j -d "${currentYear}-08-01" | sed 's/^0*//') # XXXX-08-01 ∈ [1 … 366] dayOfYear=$(date +%j | sed 's/^0*//') # this day ∈ [1 … 366] @@ -27,7 +31,7 @@ fi cat <<-ENDOFTEXT BEGIN:VCALENDAR VERSION:2.0 -PRODID:yalis.fr/epsi2ical v1.0/FR +PRODID:yalis.fr/epsi2ical v1.1 ENDOFTEXT while [ $offset -lt $offsetMax ]; do @@ -41,23 +45,32 @@ ENDOFTEXT | tr '\r\n' ' ' \ | sed -r 's/[[:blank:]]+/ /g' \ | grep -oE '