fix: [pystemon-feeder] fix #234

This commit is contained in:
Terrtia 2018-08-13 10:22:20 +02:00
parent 000d5bf40a
commit 6f2dbcb4e2
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -62,11 +62,12 @@ while True:
print(paste)
if paste is None:
continue
socket.send("%d %s" % (topic, paste))
socket.send_string("%d %s" % (topic, paste))
topic = 102
try:
messagedata = open(pystemonpath+paste).read()
socket.send("%d %s %s" % (topic, paste, base64.b64encode(messagedata)))
with open(pystemonpath+paste, 'rb') as f: #.read()
messagedata = f.read()
socket.send_string("%d %s %s" % (topic, paste, base64.b64encode(messagedata).decode()))
sleep_inc = sleep_inc-0.01 if sleep_inc-0.01 > 0 else 0
except IOError as e:
# file not found, could be a buffering issue -> increase sleeping time