This commit is contained in:
Rieger, Simon 2023-07-03 09:39:20 +02:00
parent 813195bed4
commit 8b32d1dc6c

View file

@ -1,11 +1,14 @@
#!/usr/bin/env python #!/usr/bin/env python
import datetime
import json import json
import subprocess import subprocess
from html import escape from html import escape
data = {} data = {}
today = datetime.date.today().strftime("%Y-%m-%d")
output = subprocess.check_output("khal list now 7days --format \"{start-end-time-style} {title}\"", shell=True).decode("utf-8") output = subprocess.check_output("khal list now 7days --format \"{start-end-time-style} {title}\"", shell=True).decode("utf-8")
lines = output.split("\n") lines = output.split("\n")
@ -17,7 +20,7 @@ for line in lines:
new_lines.append(clean_line) new_lines.append(clean_line)
output = "\n".join(new_lines).strip() output = "\n".join(new_lines).strip()
if "Today" in output: if today in output:
data['text'] = "" + output.split('\n')[1] data['text'] = "" + output.split('\n')[1]
else: else:
data['text'] = "" data['text'] = ""