Add reminders

Refs #3
This commit is contained in:
Trevor Vallender 2024-03-05 12:22:46 +00:00
parent 0160b8abd9
commit 7184f8e4aa
2 changed files with 8 additions and 4 deletions

View File

@ -22,6 +22,7 @@ username: <username>
password: <password>
url: <url>
ical_output: <path to output file>
days_warning: <number of days warning>
```
## Usage

View File

@ -66,6 +66,12 @@ class Birthdaze < Thor
event.summary = summary(birthday)
event.description = description(birthday)
event.rrule = "FREQ=YEARLY;"
event.alarm do |alarm|
alarm.action = "DISPLAY"
alarm.description = "It is #{birthday[:name]}s birthday on #{birthday[:day]}/#{birthday[:month]}"
alarm.summary = "Birthday reminder: #{birthday[:name]}"
alarm.trigger = "-P#{config['days_warning']}D"
end if config["days_warning"]
@calendar.add_event(event)
end
@calendar.publish
@ -99,9 +105,6 @@ class Birthdaze < Thor
"#{birthday[:name]} was born in #{birthday[:birth_year]}"
end
def set_reminders
end
def birthday_regex
# We need the dash for dates which dont specify a year
/.*BDAY.*:([\d-]*).*/
@ -123,7 +126,7 @@ class Birthdaze < Thor
return nil if date.length < 8
birth_year = date[0..3]
return nil if birth_year == "1604" # This is set (for some reason) by DAVx⁵
return nil if birth_year == "1604" # This is set by some apps for birth dates without a year
birth_year
end
end