DBus API

Engine

org.gnome.zeitgeist Interface

class _zeitgeist.engine.remote.RemoteInterface(start_dbus=True, mainloop=None)
CountEvents(min_timestamp, max_timestamp, mode, filters)

This method takes a subset of the parameters from FindEvents() and returns the amount of results a FindEvents() call with the same parameter would yield if the maximal amount of items to return isn’t limited.

Parameters:
  • min_timestamp (integer) – search for events beginning after this timestamp
  • max_timestamp (integer) – search for events beginning before this timestamp; max_timestamp equals 0 means indefinite time
  • mode (string, either event, item or mostused) – The first mode returns all events, the second and third ones only return repeated items once.
  • filters (list of tuples presenting a Filter) – list of filter, multiple filters are connected by an OR condition
Returns:

list of items

Return type:

list of tuples presenting an Item

DeleteItems(uris)

Delete items from the database

Parameters:
  • uris (list of strings) – list of URIs representing an item
EngineExit(*args, **keywords)
EngineStart(*args, **keywords)
This signal is emmitted once the engine successfully started and is ready to process requests
EventsChanged(*args, **keywords)

This Signal is emmitted whenever one or more items have been changed

It contains a tuple, where the first item is one of added, modified and deleted. If the first item is added or modified the second item is a list of Item, otherwise it is a list of uris.

Returns: added and modified items and URIs of deleted items
Return type: list of dictionaries
FindApplications(min_timestamp, max_timestamp, filters)

This method takes a subset of the parameters from FindEvents() and returns the path to the .desktop file of the applications which were used for the matching events.

Parameters:
  • min_timestamp (integer) – search for application beginning after this timestamp
  • max_timestamp (integer) – search for applications beginning before this timestamp; max_timestamp equals 0 means indefinite time
  • filters (list of tuples presenting a Filter) – list of filter, multiple filters are connected by an OR condition
Returns:

list of tuples containing the path to a .desktop file and the amount of matches for it

Return type:

list of tuples containing a string and an integer

FindEvents(min_timestamp, max_timestamp, limit, sorting_asc, mode, filters)

Search for items which match different criterias

Parameters:
  • min_timestamp (integer) – search for events beginning after this timestamp
  • max_timestamp (integer) – search for events beginning before this timestamp; max_timestamp equals 0 means indefinite time
  • limit (integer) – limit the number of returned items; limit equals 0 returns all matching items
  • sorting_asc (boolean) – sort result in ascending order of timestamp, otherwise descending
  • mode (string, either event, item or mostused) – The first mode returns all events, the second one only returns the last event when items are repeated and the mostused mode is like item but returns the results sorted by the number of events.
  • filters (list of tuples presenting a Filter) – list of filter, multiple filters are connected by an OR condition
Returns:

list of items

Return type:

list of tuples presenting an Item

GetItems(uris)

Get items by URI

Parameters:
  • uris (list of strings) – list of uris
Returns:

list of items

Return type:

list of tuples presenting an Item

GetLastInsertionDate(application)

Returns the timestamp of the last item which was inserted related to the given application. If there is no such record, 0 is returned.

Parameters:
  • application (string) – application to query for
Returns:

timestamp of last insertion date

Return type:

integer

GetTags(min_timestamp, max_timestamp, limit, name_filter)

Returns a list containing tuples with the name and the number of occurencies of the tags matching name_filter, or all existing tags in case it’s empty, sorted from most used to least used. amount can base used to limit the amount of results.

Use min_timestamp and max_timestamp to limit the time frames you want to consider.

Parameters:
  • min_timestamp (Integer) –
  • max_timestamp (Integer) –
  • name_filter (string) –
  • limit – max amount of returned elements, limit equals 0 means the result not beeing limited
Returns:

list of tuple containing the name and number of occurencies

Return type:

list of tuples

GetTypes()

Returns a list of all different types in the database.

Returns: list of types
Return type: list of strings
InsertEvents(event_list)

Inserts events into the database. Returns the amount of sucessfully inserted events

Parameters:
  • event_list – list of events to be inserted in the database
Returns:

a positive value on success, 0 otherwise

Return type:

Integer

Quit()
Terminate the running RemoteInterface process; use with caution, this action must only be triggered with the user’s explicit consent, as it will affect all application using Zeitgeist
UpdateItems(item_list)

Update items in the database

Parameters:
  • item_list (list of tuples presenting an Item) – list of items to be inserted in the database

Data Types

Item

A dict representing an item, with the following elements:

  1. timestamp (integer) -
  2. uri (string) -
  3. text (string) -
  4. source (string) -
  5. content (string) -
  6. mimetype (string) -
  7. tags (string) -
  8. comment (string) - (not used)
  9. bookmark (boolean) -
  10. use (string) -
  11. icon (string) -
  12. app (string) -
  13. origin (string) -

Filter

A dict which can have the following items:

  • name (string) -
  • uri (string) -
  • tags (list of strings) - filter by tags (AND Condition)
  • mimetypes (list of strings) - filter by mimetypes (AND Condition)
  • source (list of strings) - filter by source (AND Condition)
  • content (list of strings) - filter by source (AND Condition)
  • application (list of strings) - filter by application (ie., path to its .desktop file) (AND Condition)
  • bookmarked (boolean) -