[Tracker] Proposing new methods in the API



Hi all,

A common use case for the client applications is to show some statistics
about the data they know. For instance, in Amarok you can see how many
different artists you have in your library, how many albums... Tracker
should provide some way to retrieve this data. 

I think we have two possible solutions: 1) to complicate (even more) the
GetUniqueValues method, 2) we can add two new methods in the API.

So i would like to propose two new methods in the API:

int sum (query, property)
int count (query, property)

* Sum method:
 Run the query (if exists), and sum the value of the property in the
results. So to obtain the total playing time of Beethoven music:

tracker.sum ("RDF query to obtain all albums of Beethoven",
"Audio:Length")

 Or to obtain the total playing time in the computer:
tracker.sum (NULL, "Audio:Length")

* Count method:
 Run the query (if exists) and count the different values in the
property for the results. So to obtain how many album do you have before
1980:

tracker.count ("RDF Query: all songs of before 1980", "Audio:Album")

 Or to obtain how may albums do you have in your collection:
tracker.count (NULL, "Audio:Album")

[note: this method could be called countUniqueValues, ugly but more
descriptive]

 What do you think? Can we implement that? Do you have a better solution
for this?

Thanks,

Ivan

 




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