add proto_command option and use it for termine

This commit is contained in:
2021-07-15 13:20:21 +02:00
parent 808182cd21
commit 5a25cd1f4c
3 changed files with 8 additions and 0 deletions

View File

@@ -134,6 +134,9 @@ def conf2top(top):
if "command" in top: if "command" in top:
body = subprocess.run(top["command"], shell=True, text=True, capture_output=True, check=True).stdout 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) return Top(top["title"], sender, body, protostub)
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -45,6 +45,7 @@ post_tops:
- title: Termine - title: Termine
file: "data/termine.txt" file: "data/termine.txt"
#command: "./list_termine.sh" # if khal is setup correctly, uncomment this to read events from there #command: "./list_termine.sh" # if khal is setup correctly, uncomment this to read events from there
#proto_command: "./list_termine_proto.sh"
protostub: '{| protostub: '{|
{{"{{"}}Termin|was=AAAAAAAAAA|wann=XX.YY.{{"}}"}} {{"{{"}}Termin|was=AAAAAAAAAA|wann=XX.YY.{{"}}"}}

4
list_termine_proto.sh Executable file
View File

@@ -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 "{{'}}'}}"