Make a start on adding subscriptions
This commit is contained in:
parent
98ed132430
commit
125eb245e9
25
agenda/subscription.py
Normal file
25
agenda/subscription.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""Subscriptions."""
|
||||
|
||||
import yaml
|
||||
|
||||
from .types import Event
|
||||
|
||||
|
||||
def get_events(filepath: str) -> list[Event]:
|
||||
"""Get subscription renewal dates."""
|
||||
events = []
|
||||
with open(filepath) as f:
|
||||
items = yaml.safe_load(f)
|
||||
|
||||
for item in items:
|
||||
if "renewal_date" not in item:
|
||||
continue
|
||||
events.append(
|
||||
Event(
|
||||
date=item["renewal_date"],
|
||||
name="subscription",
|
||||
title=item["name"] + " renewal",
|
||||
)
|
||||
)
|
||||
|
||||
return events
|
Loading…
Reference in a new issue