|
|
|
@@ -1,10 +1,11 @@ |
|
|
|
|
|
|
|
from datetime import datetime |
|
|
|
import psutil |
|
|
|
import time |
|
|
|
import psutil, time, requests |
|
|
|
|
|
|
|
from win10toast import ToastNotifier |
|
|
|
toaster = ToastNotifier() |
|
|
|
from datetime import datetime |
|
|
|
from config import Gotify |
|
|
|
|
|
|
|
datetime.today().strftime('%Y-%m-%d') |
|
|
|
|
|
|
|
@@ -47,7 +48,7 @@ def countdown(founded_process): |
|
|
|
secondes = '0' + str(secondes) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
send_gotify('NSL ' + searching_process, "Uptime du processus : %s:%s:%s " % (heures, minutes, secondes) ) |
|
|
|
print("Uptime du processus : %s:%s:%s " % (heures, minutes, secondes)) |
|
|
|
toaster.show_toast("NoSocialLife Counter","Arret du programme : " + searching_process ) |
|
|
|
toaster.show_toast("NoSocialLife Counter","Uptime du processus : %s:%s:%s " % (heures, minutes, secondes)) |
|
|
|
@@ -57,6 +58,7 @@ def countdown(founded_process): |
|
|
|
f.write(date + " | Programme : " + searching_process + " | Uptime du processus : %s:%s:%s " % (heures, minutes, secondes)) |
|
|
|
f.close() |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
toaster.show_toast("NoSocialLife Counter","Programme recherché : " + searching_process ) |
|
|
|
process_running = False |
|
|
|
@@ -77,7 +79,12 @@ def main(): |
|
|
|
countdown(founded_process) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def send_gotify(title, message): |
|
|
|
resp = requests.post(Gotify['URL'] + '?token=' + Gotify['token_gotify'] , json={ |
|
|
|
"message": message, |
|
|
|
"priority": 2, |
|
|
|
"title": title |
|
|
|
}) |
|
|
|
|
|
|
|
def catch_process(searching_process): |
|
|
|
catched = False |
|
|
|
@@ -92,8 +99,5 @@ def catch_process(searching_process): |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
try : |
|
|
|
main() |
|
|
|
except : |
|
|
|
print("Erreur, Redemarrage du script") |
|
|
|
main() |
|
|
|
|
|
|
|
main() |