Re: [Tracker] How to get newly added audio files?
- From: Philip Van Hoof <philip codeminded be>
- To: simon hong <simon hong81 gmail com>
- Cc: tracker-list gnome org
- Subject: Re: [Tracker] How to get newly added audio files?
- Date: Wed, 30 Mar 2011 12:20:46 +0200
On Wed, 2011-03-30 at 18:02 +0900, simon hong wrote:
2011/3/28 Adrien Bustany <abustany gnome org>
I guess you can use the tracker:modified or tracker:added properties here
(I'd recommend tracker:modified, but am not sure how it's defined for newly
saved resources).
Now, I use "SELECT nie:url(?u) WHERE {?u a nfo:Audio}" to get audio files.
I don't know how to use above properties (tracker:modified or
tracker:added) for fetching newly added files.
Can you give some advice how to make sparql query for my purpose?
Or any documentation or guide for sparql will be appreciate.
So for synchronization what you do is the following:
SELECT MAX (tracker:modified (?r)) { ?r a rdfs:Resource }
And you store the result
Then next time you start your application, to get the newly added and
the changed resources you put that stored value in $stored and you do:
SELECT ?r { ?r a nfo:Audio .
FILTER (tracker:modified (?r) > $stored) }
Note that this is for nfo:Audio, but it works with any rdfs:Resource
Note that instead of looping, you could also use the GraphUpdated signal to
get updates in real time.
GraphUpdated signal is what I wanted ^^; It works well :)
If GraphUpdated works for you, then indeed use that.
Cheers,
Philip
--
Philip Van Hoof
freelance software developer
Codeminded BVBA - http://codeminded.be
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]