X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/fab7f37dff1f0bba696d54ae5f0c3dc7b48519b3..68e6a1194080e79c23608ff55f2c7fa054f3c6fc:/mutt/ical2txt?ds=inline diff --git a/mutt/ical2txt b/mutt/ical2txt new file mode 100755 index 0000000..5b7c998 --- /dev/null +++ b/mutt/ical2txt @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +from icalendar import Calendar + +def format_cal(start, end, description): + str = "Start: {:%Y-%m-%d %H:%M}\n".format(start) + str += "End: {:%Y-%m-%d %H:%M}\n\n".format(end) + if description is not None: + str += description + + return str + + +with open('/dev/stdin', 'r') as f: + cal = Calendar.from_ical(f.read()) + +for c in cal.walk(): + if c.name == "VEVENT": + print(format_cal( + c.get('dtstart').dt, + c.get('dtend').dt, + c.get('description')))