marco
By: a guest | Feb 19th, 2009 | Syntax:
Python | Size: 1.08 KB | Hits: 249 | Expires: Never
diff -uNr old/twitnotify.py new/twitnotify.py
--- old/twitnotify.py 2008-08-05 12:40:21.000000000 +0200
+++ new/twitnotify.py 2009-02-19 18:27:17.000000000 +0100
-40,6 +40,9 @@
2. Get a Twitter account. Add some friends (e.g. zeth0).
3. Set up the USERNAME and PASSWORD below.
+Set up EXPIRE_TIME which defines for how long the notification
+well be shown, e.g. "5" for 5 seconds or "NEVER" if you don't
+want the notification to be closed automatically
4. Run the script and (optionally) background it.
-61,6 +64,7 @@
USERNAME = "zeth0"
PASSWORD = "lenna"
+EXPIRE_TIME = "NEVER"
#####################################
# These should be fine for most users
-152,6 +156,11 @@
if not pynotify.init("Twitter Notify"):
sys.exit(1)
note = pynotify.Notification(user, message, imageurl)
+ if EXPIRE_TIME == "NEVER":
+ note.set_timeout(pynotify.EXPIRES_NEVER)
+ else:
+ note.set_timeout(int(EXPIRE_TIME)*1000)
+
if not note.show():
print "Failed to send notification"
sys.exit(1)