Re: [Tracker] General file stat info



What I need right now is to fetch filename, size, owner, group etc..
1. Can I get more detail if I checkout the newest revision?
2. Is it possible to connect to the back-end database and safely do
queries
to get the data I need? (I am aware of the fact that database designs
change over time so the solution isn't long lasting)


python has excellent dbus bindings so best way is to call the methods
directly over it

the query method takes in a list of metadata that you want to output so
yes (1) is very easy

I'm very green in dbus programming. I pulled the code underneath out of
trackergui.py and it seems to work. Could you give me a hint on how to
fetch stats (ie owner or filesize)?

import sys,os,dbus,re
#from mainform import *

class TrackerClient:

        def __init__(self):
                bus = dbus.SessionBus()
                obj =
bus.get_object('org.freedesktop.Tracker','/org/freedesktop/tracker')
                #self.tracker = dbus.Interface(obj,
'org.freedesktop.Tracker')
                self.keywords_iface = dbus.Interface(obj,
'org.freedesktop.Tracker.Keywords')
                self.search_iface = dbus.Interface(obj,
'org.freedesktop.Tracker.Search')
                self.files_iface = dbus.Interface(obj,
'org.freedesktop.Tracker.Files')

                #self.version = self.tracker.GetVersion()

                #Self service eheheh
                #self.services = self.tracker.GetServices(True)
                self.services = ['Files','Development
Files','Documents','Images','Music','Text Files','Videos']
                self.query_id = 0

        def search(self,text,service='Files',offset=0,max_hits=-1):
                self.returnedfiles =
self.search_iface.TextDetailed(1,service,text,offset,max_hits)
                if len(self.returnedfiles) > 0:
                        return self.returnedfiles
                else:
                        self.on_tracker_error("Nothing files found")
                        return 0





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]