remindme_caldav/README.md

2.3 KiB

remindme_caldav

A Calendar Alerting Daemon

Purpose

This script is a simple calendar alerting daemon written in Python. It monitors .ics files for changes and sends alerts based on the events' start times, recurrence rules, and alert triggers defined within these files. The main purpose of this script is to provide reminders or notifications about upcoming events.

How it Works

The script works by parsing .ics files using the icalendar library, which converts them into a Python dictionary format for easier manipulation. It then processes each event and calculates when the next alert should be triggered based on the event's start time, recurrence rules, and alert triggers. If an alert is due to trigger, it sends a notification via email or XMPP (an instant messaging protocol).

The script also monitors for changes in the directory containing .ics files using the watchdog library. When a file is modified, created, or deleted, it updates its internal list of events accordingly.

How to Use It

This script should be used with a calendar syncing service such as vdirsyncer. vdirsyncer can be scheduled using cron to sync regularly from the CalDav server.

To use this script, you need Python 3 installed on your system. You can install the required libraries by running:

pip install -r requirements.txt

You also need a .toml configuration file with the following structure:

[app]
calendar_dir = "/path/to/your/ics/files"
email_address = "your-email@example.com"
smtp_server = "smtp.example.com"
smtp_port = 587
smtp_username = "your-username"
smtp_password = "your-password"
...

You can then run the script with:

python3 remindme_caldav.py --config /path/to/your/config.toml

Installation

A Makefile and systemd service file is also included for Debian/Ubuntu based systems.

This Makefile does the following:

  • install: Installs Python 3.11, creates a virtual environment in /opt/remindme_caldav/.venv, installs dependencies from requirements.txt into this virtual environment, copies your script to /opt/remindme_caldav/, and sets up the systemd service file.

  • uninstall: Stops and disables the systemd service, removes the installation directory (/opt/remindme_caldav/), and deletes the systemd service file.

  • clean: Deactivates the virtual environment.