From 5a25cd1f4c4517a31ed42aa99092b4285f20e7f2 Mon Sep 17 00:00:00 2001 From: Yannik Enss Date: Thu, 15 Jul 2021 13:20:21 +0200 Subject: [PATCH] add proto_command option and use it for termine --- generate.py | 3 +++ generator.conf.example | 1 + list_termine_proto.sh | 4 ++++ 3 files changed, 8 insertions(+) create mode 100755 list_termine_proto.sh diff --git a/generate.py b/generate.py index 5fb621d..2520a91 100755 --- a/generate.py +++ b/generate.py @@ -134,6 +134,9 @@ def conf2top(top): if "command" in top: body = subprocess.run(top["command"], shell=True, text=True, capture_output=True, check=True).stdout + if "proto_command" in top: + protostub = subprocess.run(top["proto_command"], shell=True, text=True, capture_output=True, check=True).stdout + return Top(top["title"], sender, body, protostub) if __name__ == "__main__": diff --git a/generator.conf.example b/generator.conf.example index c0a0e3f..98eda6e 100644 --- a/generator.conf.example +++ b/generator.conf.example @@ -45,6 +45,7 @@ post_tops: - title: Termine file: "data/termine.txt" #command: "./list_termine.sh" # if khal is setup correctly, uncomment this to read events from there + #proto_command: "./list_termine_proto.sh" protostub: '{| {{"{{"}}Termin|was=AAAAAAAAAA|wann=XX.YY.{{"}}"}} diff --git a/list_termine_proto.sh b/list_termine_proto.sh new file mode 100755 index 0000000..f89fc59 --- /dev/null +++ b/list_termine_proto.sh @@ -0,0 +1,4 @@ +#!/bin/sh -e +echo "{{'{{'}}" +khal list --day-format "" --format "{{{{'{{{{'}}}}Termin|was={title}|wann={start}{{{{'}}}}'}}}}" -a calendars_fsmi today 30d | grep -v Fachschaftsrat +echo "{{'}}'}}"