105 lines
3.2 KiB
Plaintext
105 lines
3.2 KiB
Plaintext
/////
|
||
# The epsi2ics project produces an ICS file from an EPSI school-year calendar.
|
||
# 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.
|
||
/////
|
||
|
||
= 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
|
||
DTSTART:20191001T130000+0200
|
||
DTEND:20191001T150000+0200
|
||
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.
|
||
|
||
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.
|
||
|
||
The current locale must be an UTF-8 locale.
|
||
|
||
== Usage
|
||
|
||
The first parameter to the script is the student login name (firstname.lastname). The second parameter is the ICS file to write; standard output is used if no path is provided, or if the chosen location is not writeable.
|
||
|
||
Optionally, a systemd service can be written:
|
||
|
||
```systemd
|
||
# /etc/systemd/system/epsi2ics.service
|
||
[Unit]
|
||
Description=Create an ICS file based on EPSI’s web calendar
|
||
|
||
[Service]
|
||
Type=oneshot
|
||
ExecStart=/path/to/epsiEDTtoICS.sh YOUR.LOGIN /srv/http/calendar.ics
|
||
```
|
||
|
||
and a systemd timer can update the calendar weekly:
|
||
|
||
```systemd
|
||
# /etc/systemd/system/epsi2ics.timer
|
||
[Unit]
|
||
Description=Run epsi2ics weekly
|
||
|
||
[Timer]
|
||
OnCalendar=weekly
|
||
|
||
[Install]
|
||
WantedBy=timers.target
|
||
```
|
||
|
||
[literal.small]
|
||
.....
|
||
# The epsi2ics project produces an ICS file from an EPSI school-year calendar.
|
||
# 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.
|
||
.....
|