Commit Graph

26 Commits

Author SHA1 Message Date
mrsu f604dcbae3 Update logging and add file detection for calendar files
- Updated setup_logging function to accept a logfile argument with default value "log"
- Changed basicConfig to use the provided logfile argument
- Updated parse_args to set default logfile value to "log" in current directory
- Added while loop to detect calendar files in sync location before proceeding with main logic
- Updated main function to call setup_logging with args.logfile and added file detection logic
2024-02-16 00:48:38 +00:00
mrsu d892cdbd4b Update logging and error handling in remindme_caldav.py
- Updated the logging configuration to use a custom format and set the log level based on command line arguments.
- Added more detailed error messages for file not found, failed TOML parsing, and failed calendar parsing.
- Improved exception handling during event processing and added more informative error messages.
2024-02-16 00:34:53 +00:00
mrsu a2a508fd31 Update Makefile and service file for installing remindme_caldav
- Create new directories in /etc/
- Update the install command to include the new directories creation
2024-02-15 22:54:56 +00:00
Sam aeb1eddbbb Update uninstall process to remove additional files and directories
- Updated the `uninstall` target in Makefile to also remove the `/etc/remindme_caldav` directory.
2024-02-15 20:03:59 +00:00
Sam 22e15fc49d Update install process and add configuration file management
- Added mkdir command to create /etc/remindme_caldav directory.
- Copied config.toml to the new directory.
- Updated Makefile install instructions to include these changes.
- Updated comment in config.toml to provide a link to the readme for an example configuration.
- Removed placeholder values from all sections of the config file.
- Added check to ensure there are .ics files in the destination location before parsing them.
- If no files are found, log a message and exit with an error code.
2024-02-15 19:56:40 +00:00
Sam 4deeda0964 Update log file path and add logging to service
- Updated the `parse_args()` function to include a new argument `--logfile`, which allows users to specify a custom log file. The default value is "none".
- Modified the `main()` function to check if the user provided a log file using the `--logfile` argument. If a log file is specified, it adds a FileHandler to the logger and sets the logging level based on the `--loglevel` argument.
- Updated the `remindme_caldav.service` file to include the `--logfile` argument in the `ExecStart` command. This ensures that the log file is used when the service starts.
2024-02-15 18:46:33 +00:00
Sam 89994c1f0a Update logging and error handling
* Move from basic logging to more detailed logging with a log file.
* Improve error handling in several functions.
* Modify the way log messages are displayed.
2024-02-15 18:12:13 +00:00
Sam ef00f112f3 Update error handling and logging in remindme_caldav.py
- Replace RuntimeError with logging.error.
- Add sys.exit(1) to terminate the program when a critical error occurs.
2024-02-15 17:48:18 +00:00
Sam 30dc31344c Update Makefile and Python scripts
- Updated the install command to use python3-venv instead of python3.11-venv.
- Added alert_processor.py to the list of files copied to /opt/remindme_caldav/.
- Changed the activation of the virtual environment and pip installation commands.
- Updated logging to not use f-strings
2024-02-15 17:02:22 +00:00
Sam 33244c1994 Fix formatting of Makefile 2024-02-15 15:39:55 +00:00
Sam 8fe759673d Update Makefile, README and service file for remindme_caldav
- The Makefile now includes installation instructions for Debian/Ubuntu based systems.
- The README has been updated with more detailed descriptions of the script's purpose, how it works, and how to use it.
- The service file has been added to manage the remindme_caldav daemon on a systemd-based system.
2024-02-15 15:21:37 +00:00
mrsu 740ac039dd Improved logging, error handling and documentation 2024-02-12 23:57:58 +00:00
mrsu 6b2d3bef53 Update dependencies 2024-02-12 02:30:50 +00:00
mrsu 2c8151870c Refactor code to combine email and XMPP alerting into single class
- Create a new module `alert_processor.py` for handling both email and XMPP alerts.
- Remove the email_alert.py and xmpp_alert.py files.
2024-02-12 02:19:49 +00:00
mrsu ea34a0ef32 minor changes 2024-02-12 01:21:50 +00:00
mrsu e4c42de74c created CalendarParser class 2024-02-11 19:43:33 +00:00
mrsu f239b4fb23 Complete refactor of script to make it more pythonic 2024-02-10 23:53:15 +00:00
mrsu f6b1b2d5ee Refactor remindme_caldav.py for improved code maintainability and readability
* Refactored `remindme_caldav.py` to separate concerns into different functions:
  - `calendar_parser()`: Parses the calendar and generates event dictionaries.
  - `generate_recurring_event_dates()`: Generates recurring event dates based on a start date and an RRULE.
  - `get_next_alert()`: Calculates the next alert time for each event.
  - `process_alert()`: Processes alerts for each event.
* Implemented error handling in `calendar_parser()` to catch missing components without crashing the program.
* Added comments and docstrings for better code readability and maintainability.
* Modified `get_next_alert()` to handle events with no recurring dates.
* Updated `process_alert()` to subtract 15 seconds from the next alert time to ensure alerts are triggered before the event occurs.
* Added a human-readable format for the time until the next alert in the status message.
2024-02-10 19:37:37 +00:00
Sam 92e1578bbc Replace toml with humanfriendly library for email alert and update send\_email function with event details
* Update import statement in email_alert.py to include humanfriendly library
* Modify send_email function signature in email_alert.py to accept an event dictionary instead of separate arguments
* Extract event name, description, location, date, and time until event from the event dictionary and use them in the email body
* Update email body format string accordingly
* Use humanfriendly library to format time difference between next alert and next event into a human-readable format.
2024-02-09 12:08:31 +00:00
mrsu 236a311b5c track .gitignore 2024-02-08 15:41:09 +00:00
mrsu 1b225d08fd modify datetime 2024-02-08 15:32:49 +00:00
mrsu eb6b8db0ea alerting and filehandling
Added both xmpp and email alerting
Proper FileHandling to manage modified, deleted and new events
Argument parsing and added toml config
2024-02-06 19:02:44 +00:00
mrsu c41a9ae7cf requirements.txt 2024-02-04 13:47:09 +00:00
mrsu 25e82df28a Merge branch 'master' of git.bitlab21.com:sam/remindme_caldav 2024-02-04 03:04:02 +00:00
sam 5da20d2d92 Initial commit 2024-02-04 03:01:11 +00:00
mrsu 5c4db272a7 inital commit 2024-02-04 02:53:30 +00:00