Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 11th, 2012  |  syntax: None  |  size: 0.82 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. initial_input_list = os.popen("ls /home/daniel/log | grep -v \# | grep -v \& | grep -v server | grep -v core\.wee").readlines()
  2. buffer_list = []
  3.  
  4. for s in initial_input_list:
  5.     buffer_list.append(s.strip())
  6.  
  7. oldnotifications = {}
  8.  
  9. while 1:
  10.     try:
  11.         for b in buffer_list:
  12.             i="tail -n1 /home/daniel/log/" + b
  13.             title,message,old_message = makeMessage(i)
  14.             try:
  15.                 if oldnotifications[b] == old_message:
  16.                     pass
  17.                 else:
  18.                     print message
  19.                     oldnotifications[b] = old_message
  20.                     pushNotification(title, message, "notification-message-im")
  21.             except:
  22.                 oldnotifications[b] = old_message
  23.         time.sleep(.05)
  24.     except KeyboardInterrupt:
  25.         sys.exit(0)