forked from JamezQ/Palaver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpm
More file actions
executable file
·25 lines (23 loc) · 722 Bytes
/
Copy pathpm
File metadata and controls
executable file
·25 lines (23 loc) · 722 Bytes
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
#!/usr/bin/env python
import pynotify, urllib2, subprocess
f = urllib2.urlopen("http://palaver.bmandesigns.com/functions.php?f=messageUpdate")
id,title,text = f.read().split("||")
with open("CONFIG",'r') as data:
for l in data.read().split("\n"):
if l.startswith("LASTID="):
lastId = l.replace("\n",'').replace("LASTID=",'')
if int(id) > int(lastId):
pynotify.init("Speech Recognition")
n = pynotify.Notification(title,text)
n.show()
lines = []
with open("CONFIG",'r') as data:
for l in data.read().split("\n"):
lines.append(l)
with open("CONFIG",'w') as data:
for l in lines:
if l.startswith("LASTID="):
data.write("LASTID="+str(id)+"\n")
else:
if l != '\n':
data.write(l+"\n")