#!/usr/bin/env python3
import sys
from pathlib import Path
from datetime import datetime, date
from typing import Optional, NamedTuple
from dataclasses import dataclass
import requests
from bs4 import BeautifulSoup
from icalendar import Calendar
import recurring_ical_events
import locale
@dataclass
class EventDetails:
weekday: str
date: str
time: str
summary: str
location: str
def to_html(self) -> str:
return (
f'
{self.weekday} '
f'{self.date}{self.time}, {self.summary}'
f'{self.location}
'
)
class EventProcessor:
def __init__(self, ics_url: str, content_file: str):
self.ics_url = ics_url
self.content_file = Path(content_file)
self.fallback_html = (
'Leider unbekannt, aber '
'frag mal den Vorstand der müsste es wissen
'
)
@property
def fallback_content(self) -> str:
return f"""_model: htmlpage
---
title: Willkommen beim PC Stammertal
---
html:
Unser nächster Anlass:
{self.fallback_html}