Split everything into modules

This commit is contained in:
2025-06-05 15:23:34 -04:00
parent 6a7b07ebeb
commit af2fe80ce5
4 changed files with 86 additions and 51 deletions

16
src/ntfy.py Normal file
View File

@ -0,0 +1,16 @@
import subprocess
import main
import time
last_ntfy_send: float = time.time()
def send(message: str):
try:
if main.ntfy_url:
global last_ntfy_send
last_ntfy_send = time.time()
subprocess.run(["curl", "-d", f"\"{message}\"", main.ntfy_url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
print("Ntfy send: url is not configured.")
except Exception as err:
print(f"Ntfy failed. {err}")