diff --git a/monitor.py b/monitor.py index 97c3cad..2e1043e 100644 --- a/monitor.py +++ b/monitor.py @@ -2,6 +2,7 @@ from watchdog.events import PatternMatchingEventHandler import time from message import send_message +from windows_notification import show_windows_notification import os @@ -21,6 +22,8 @@ def __init__(self, config): def on_created(self, event): send_message(self.token, self.chat_id) print("Sending message...") + # Uncoment the following line to enable windows notifications + # show_windows_notification() if os.path.exists(event.src_path): os.remove(event.src_path) # Delete the screenshot we created diff --git a/requirements.txt b/requirements.txt index 7ef008f..3f1ec4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ requests toml -watchdog \ No newline at end of file +watchdog +winsdk \ No newline at end of file diff --git a/windows_notification.py b/windows_notification.py new file mode 100644 index 0000000..656615e --- /dev/null +++ b/windows_notification.py @@ -0,0 +1,31 @@ +import winsdk.windows.ui.notifications as notifications +import winsdk.windows.data.xml.dom as dom + +# create notification objects +nManager = notifications.ToastNotificationManager +notifier = nManager.create_toast_notifier(r"C:\Python310\python.exe") # put your python path there. + +# define the xml notification document. +tString = """ + + + + Solo Shuffle Queue! + + + + + + + +""" + +# load the xml document. +xDoc = dom.XmlDocument() +xDoc.load_xml(tString) +notification = notifications.ToastNotification(xDoc) + +# display notification +def show_windows_notification(): + notification = notifications.ToastNotification(xDoc) + notifier.show(notification) \ No newline at end of file