A simple script to send alerts/reminders for caldav events.
Go to file
Sam a5583d981b Update log directory check in setup_log_location function
* Updated the condition to check if the log directory exists by using Path(logdir).is_dir() instead of Path.is_dir(logdir).
2024-02-16 12:36:05 +00:00
.gitignore Update logging and error handling 2024-02-15 18:12:13 +00:00
LICENSE Initial commit 2024-02-04 03:01:11 +00:00
Makefile Update logging and file handling 2024-02-16 11:57:51 +00:00
README.md Update Makefile, README and service file for remindme_caldav 2024-02-15 15:21:37 +00:00
alert_processor.py Refactor code to combine email and XMPP alerting into single class 2024-02-12 02:19:49 +00:00
config.toml Update logging and error handling in remindme_caldav.py 2024-02-16 00:34:53 +00:00
remindme_caldav.py Update log directory check in setup_log_location function 2024-02-16 12:36:05 +00:00
remindme_caldav.service Update systemd service file for remindme_caldav 2024-02-16 10:21:21 +00:00
requirements.txt Update dependencies 2024-02-12 02:30:50 +00:00

README.md

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.