/////
# The epsi2ics project produces an ICS file from an EPSI school-year calendar.
# Copyright © 2019–2020 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.
/////

= EPSI to ICS
:toc:

== Introduction

For some reason, the tool chosen by the EPSI school to publish their school calendars to students, does not provide either CalDav or ICalendar access!

Since the ICS format is easy enough to generate, it was a simple task to convert the HTML to ICS.

== Features

This tool transforms each block looking like that:

```html
<DIV class="Case" style="background-color:#EEDDEE;width:18.85000000000000000000000%;top:155.1500%;left:122.5200%;height:19.2000%;">
  <div class="innerCase" style="border:3px solid #800080;">
    <img class="IMG_FondCase" SRC="img/fond_deg.png"/>
    <div class="BackGroundCase">
      <table class="TCase" border=1>
        <tr>
          <td class="TCase" colspan="2" style="font-size:100%;">
            <div class="Presence"><img src=/img/valide.png></div>
            HTLM5 / CSS3
          </td>
        </tr><tr>
          <td colspan="2" class="TCProf" height="1.2em">
            teacher name<br/>
            class-group name
          </td>
        </tr><tr>
          <td class="TChdeb">13:00 - 15:00</td>
          <td class="TCSalle">Salle:N202(HEP Nantes)</td>
        </tr>
      </table>
    </DIV>
  </div>
</div>
```

into entries like that:

```
BEGIN:VEVENT
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
END:VEVENT
```

The script generates these entries starting from the middle of the past summer, until the middle of the next summer.
However, a “patch” mode is available, that updates a given number of weeks, starting from the current one.

The source “XHTML” is definitely not XML, and hardly HTML at that, so the script does not use any XML tooling, and does its best to have the right data in the right format.
If you encounter a bug, do not hesitate to create a ticket `;-)`

== Requirements

Very few requirements: bash, GNU awk, GNU date, sed, tr, and curl, usually on Linux. This probably also works on MacOS-X, Cygwin, Git-bash, WSL, and so on.
Optionally, `sendmail` can be used to notify of calendar changes, and `systemd` can automate the process.

The current locale must be an UTF-8 locale.

== Usage

See the header of the script for parameters: the student login name (firstname.lastname); the ICS file to write; email addresses to notify, etc.

systemd unit-files and packaging are provided for ArchLinux.

[literal.small]
.....
# The epsi2ics project produces an ICS file from an EPSI school-year calendar.
# Copyright © 2019–2020 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.
.....
