Share Pastebin
Guest
Public paste!

marco

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