forked from ultralytics/yolov5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathline.py
42 lines (32 loc) · 894 Bytes
/
line.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from line_notify import LineNotify
import queue
import threading
my_queue = queue.Queue(maxsize=20)
ACCESS_TOKEN = "nuh9EJ1J5DVBcAWmzEyOkDVqQsuRkhewzVKsqv0ZRVv"
notify = LineNotify(ACCESS_TOKEN)
notify.send("System started...")
def addQueue(obj):
if not my_queue.empty() and obj['name'] == my_queue.queue[-1]:
return
else:
if my_queue.full():
my_queue.get()
my_queue.put(obj)
def sendText(text):
notify.send(text)
def sendImage(text, path):
notify.send(text, image_path=path)
def sendTextQueue(text):
my_queue.put(text)
def threadNotify():
result = ""
while not my_queue.empty():
item = my_queue.get()
result += item + ", "
if result != "":
sendText(result)
print("Notify checking...")
def startThread():
threading.Timer(5.0, startThread).start()
threadNotify()
startThread()