Re: [Tracker] General file stat info



On Tue, 2007-07-10 at 23:32 +0200, tracker-list wrote:
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)?


use Get method on the metadata interface

<interface name="org.freedesktop.Tracker.Metadata">

                <!-- Retrieves an array of metadata values for the specified array of
metadata keys for a service and id pair-->
                <method name="Get">
                        <arg type="s" name="service" direction="in" />
                        <arg type="s" name="id" direction="in" />
                        <arg type="as" name="keys" direction="in" />
                        <arg type="as" name="values" direction="out" />
                </method>

see tracker-introspect.xml for description of all methods

I dont know enough python to give you python examples

but call Get ("Files", "/home/jamie/filename", ["File:Size",
"File:Mime"], output)

                





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