Advertisement
Guest User

Untitled

a guest
May 13th, 2012
48
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2. from gi.repository import GObject
  3. from zeitgeist.client import ZeitgeistClient
  4. from zeitgeist.datamodel import Event, Subject, Interpretation, Manifestation
  5.  
  6. mainloop = GObject.MainLoop ()
  7. zg = ZeitgeistClient ()
  8.  
  9. temps = [Event.new_for_values(subject_interpretation = Interpretation.DOCUMENT),
  10.          Event.new_for_values(subject_interpretation = Interpretation.AUDIO),
  11.          Event.new_for_values(subject_interpretation = Interpretation.WEBSITE),
  12.          Event.new_for_values(subject_interpretation = Interpretation.IMAGE),
  13.          Event.new_for_values(subject_interpretation = Interpretation.VIDEO),
  14.     ]
  15.  
  16. end = int(time.time ()*1000)
  17. start = 0
  18.  
  19. t = time.time ()
  20.  
  21. def callback (events):
  22.   print len (events), time.time() - t
  23.   mainloop.quit()
  24.  
  25. zg.find_event_ids_for_templates(temps, callback, timerange=(start, end), num_events=0, result_type=2)
  26.  
  27. mainloop.run ()
Advertisement
RAW Paste Data Copied
Advertisement