Exemplo n.º 1
0
def insert_events(events):
    iface = ZeitgeistDBusInterface()
    print "Inserting %d events..." % len(events)
    while len(events):
        iface.InsertEvents(events[:LIMIT])
        events = events[LIMIT:]
        print "."
    print 'OK.'
Exemplo n.º 2
0
    def _get_blacklist_iface(self):
        """
		Create a blacklist interface using the get_extension() method
		from client.py.
		"""
        del self.blacklist
        iface = ZeitgeistDBusInterface()
        blacklist = iface.get_extension("Blacklist", "blacklist")
        return blacklist
	def _get_blacklist_iface(self):
		"""
		Create a blacklist interface using the get_extension() method
		from client.py.
		"""
		del self.blacklist
		iface = ZeitgeistDBusInterface()
		blacklist = iface.get_extension("Blacklist", "blacklist")
		return blacklist
Exemplo n.º 4
0
class EventInserter():

    BUFFER_SIZE = 1000

    _log = None
    _buffer = None
    _events_inserted = None

    def __init__(self):
        self._log = ZeitgeistDBusInterface()
        self._buffer = []
        self._events_inserted = 0

    def insert(self, event):
        buffer_full = len(self._buffer) >= self.BUFFER_SIZE
        if buffer_full:
            self.flush()
        self._buffer.append(event)
        return buffer_full

    def flush(self):
        if self._buffer:
            self._log.InsertEvents(self._buffer)
            self._events_inserted += len(self._buffer)
            self._buffer = []

    def get_insertion_count(self):
        return self._events_inserted
Exemplo n.º 5
0
    def __init__(self, log=log):
        self.log = log
        self._zclient = ZeitgeistClient()
        self._zdclient = ZeitgeistDBusInterface()
        self._database = DesktopDatabase(DATABASE_NAME, create=True)

        self._user = os.environ.get('USERNAME')
        self._machine = os.uname()
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import gtk
import gobject
from gettext import install, ngettext  # TODO: Setup translations.

from zeitgeist.datamodel import Interpretation, Manifestation, DataSource
from zeitgeist.client import ZeitgeistDBusInterface

CLIENT = ZeitgeistDBusInterface()
REGISTRY = CLIENT.get_extension("DataSourceRegistry", "data_source_registry")


class DataSourceList(gtk.TreeView):
    def __init__(self, activate_callback=None, select_callback=None):
        super(DataSourceList, self).__init__()

        self.store = gtk.TreeStore(str, str, bool, bool, gobject.TYPE_PYOBJECT)
        self.selection = self.get_selection()  # gtk.TreeSelection
        self.set_model(self.store)
        self.set_search_column(0)

        col = self._create_column(_("Name"))
        col[0].add_attribute(col[1], "text", 0)
        col = self._create_column(_("Description"))
Exemplo n.º 7
0
#! /usr/bin/env python
from zeitgeist.client import ZeitgeistDBusInterface
from zeitgeist.datamodel import Event, Interpretation, TimeRange, \
 StorageState, ResultType
from datetime import datetime
import dateutil

zg = ZeitgeistDBusInterface()
events = zg.FindEvents(
    #timerange
    TimeRange.always(),
    #Evente template
    [Event.new_for_values(
           interpretation=\
           Interpretation.EVENT_INTERPRETATION.LEAVE_EVENT)],
    #Storage State
    StorageState.Any,
    #How many results
    10,
    #Result sort
    ResultType.MostRecentEvents)

for event in events:
    last_event = Event(event)
    last_subject = last_event.get_subjects()[0]
    print last_subject.uri, datetime.fromtimestamp(float(last_event.timestamp) / 1000)

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import gtk
import gobject
from gettext import install, ngettext # TODO: Setup translations.

from zeitgeist.datamodel import Interpretation, Manifestation, DataSource
from zeitgeist.client import ZeitgeistDBusInterface

CLIENT = ZeitgeistDBusInterface()
REGISTRY = CLIENT.get_extension("DataSourceRegistry", "data_source_registry")

class DataSourceList(gtk.TreeView):
    
    def __init__(self, activate_callback=None, select_callback=None):
        super(DataSourceList, self).__init__()
        
        self.store = gtk.TreeStore(str, str, bool, bool, gobject.TYPE_PYOBJECT)
        self.selection = self.get_selection() # gtk.TreeSelection
        self.set_model(self.store)
        self.set_search_column(0)
        
        col = self._create_column(_("Name"))
        col[0].add_attribute(col[1], "text", 0)
        col = self._create_column(_("Description"))
Exemplo n.º 9
0
import io
import os
import signal
import subprocess
import time
from itertools import permutations

from mimetypes import guess_type

from sys import version_info

try:
    from zeitgeist.client import ZeitgeistDBusInterface
    from zeitgeist.datamodel import Event, TimeRange
    from zeitgeist import datamodel
    iface = ZeitgeistDBusInterface()
    zeitgeist_support = True
except Exception:
    zeitgeist_support = False

logger = logging.getLogger('catfish_search')
python3 = version_info[0] > 2
engine_count = 0

FNULL = open(os.devnull, 'w')
if subprocess.call(['which', 'locate'],
                   stdout=FNULL, stderr=subprocess.STDOUT) == 0:
    locate_support = True
else:
    locate_support = False
FNULL.close()
Exemplo n.º 10
0
 def __init__(self):
     self._log = ZeitgeistDBusInterface()
     self._buffer = []
     self._events_inserted = 0