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.
This commit is contained in:
Sam 2024-02-15 19:56:40 +00:00
parent 4deeda0964
commit 22e15fc49d
3 changed files with 18 additions and 11 deletions

View File

@ -4,6 +4,8 @@ install:
cp remindme_caldav.py alert_processor.py /opt/remindme_caldav/
. /opt/remindme_caldav/.venv/bin/activate && pip3 install -r requirements.txt
sudo cp remindme_caldav.service /etc/systemd/system/
sudo mkdir /etc/remindme_caldav
sudo cp config.toml /etc/remindme_caldav/config.toml
sudo systemctl daemon-reload
sudo systemctl enable remindme_caldav.service
sudo systemctl start remindme_caldav.service

View File

@ -1,16 +1,16 @@
# Modify to your requirements
# Modify to your requirements. See readme for example.
[app]
calendar_dir = "FULL_PATH_TO_.ICS_CALENDAR_FILES"
calendar_dir =
[email]
smtp_server = "SMTP.PROVIDER.DOMAIN"
port = 587
username = "YOUR_USERNAME"
password = "YOUR_PASSWORD"
recipient = "RECIPIENT_EMAIL_ADDRESS"
smtp_server =
port =
username =
password =
recipient =
[xmpp]
jid = 'YOUR_USERNAME@SERVER_INSTANCE.DOMAIN'
password = 'YOUR_PASSWORD'
recipient = 'RECIPIENT_USERNAME@SERVER_INSTANCE.DOMAIN'
jid =
password =
recipient =
[notify-send]

View File

@ -33,7 +33,8 @@ def read_file(filename):
def parse_toml(content):
try:
return toml.loads(content)
config = toml.loads(content)
return config
except Exception as e:
logger.error("Error: Failed to parse TOML file.")
sys.exit(1)
@ -371,6 +372,10 @@ def main():
#Parse calendar events
calendar_parser = CalendarParser()
files = list(cal_dir.glob('*.ics'))
if len(files) == 0:
logger.info("No calendar files in destination location. Did you sync with the caldav server?")
sys.exit(1) # Exit with error code
event_list = [] # List to hold dictionaries for each event
for file in files:
with open(file, 'r') as f: