After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740707 - tracker: Add range filter support
tracker: Add range filter support
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: plugins
git master
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks: 737469
 
 
Reported: 2014-11-25 20:55 UTC by Bastien Nocera
Modified: 2015-01-27 17:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tracker: Add duration filtering support (8.35 KB, patch)
2014-12-02 13:53 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-11-25 20:55:34 UTC
In Videos, we'd like to ignore the smaller videos, for example:
grl_operation_options_set_key_range_filters (my_options,
                                               GRL_METADATA_KEY_DURATION, 2, NULL,
                                               NULL);
to ignore videos smaller than 2 seconds.
Comment 1 Martyn Russell 2014-12-02 11:53:27 UTC
Hi Bastien, just tested this, it works:

"""
SELECT
  ?m nfo:fileName(?m) ?duration
WHERE { 
  ?m a nfo:FileDataObject .
  OPTIONAL { 
    ?m nfo:duration ?duration
  } .
  FILTER(?duration > 200 || !BOUND(?duration))
}
"""

Let me explain what it does:
1. It returns all FILES, you can change the nfo:FileDataObject to nmm:MusicPiece or nfo:Audio depending on what you want here.
2. The OPTIONAL is a LEFT OUTER JOIN in database terms, it's not super performant but it's the only way you can add data that may or may not be there.
3. The FILTER is quite obvious initially, but the !BOUND means that we filter out any cases where duration is not specified. This works with the OPTIONAL because we don't know if ?duration is always available. The BOUND is a SPARQL feature documented here: http://www.w3.org/TR/rdf-sparql-query/#func-bound

Happy to help ;)
Comment 2 Martyn Russell 2014-12-02 11:54:33 UTC
Finally, I should add, the "200" is 200 seconds, it's just what I tested with because my data was ALL album track length content. You would of course use "2".
Comment 3 Bastien Nocera 2014-12-02 13:53:32 UTC
Created attachment 291990 [details] [review]
tracker: Add duration filtering support

Duration filtering support for search and browse. Note that
query doesn't add the duration filtering automatically.
Comment 4 Bastien Nocera 2015-01-27 17:36:35 UTC
Attachment 291990 [details] pushed as 44bf700 - tracker: Add duration filtering support