[gnome-music/auto_populate: 1/2] Implemented offset



commit a4343b77b4ffaa38f6fea2fa73f0b5f630e747d9
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Thu Apr 4 00:59:10 2013 +0200

    Implemented offset

 src/grilo.js |    3 ++-
 src/query.js |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/grilo.js b/src/grilo.js
index 3f19508..443e143 100644
--- a/src/grilo.js
+++ b/src/grilo.js
@@ -76,7 +76,8 @@ const Grilo = new Lang.Class({
     populateItems: function (query, offset, callback) {
         var options = Grl.OperationOptions.new(null);
         options.set_flags (Grl.ResolutionFlags.FULL | Grl.ResolutionFlags.IDLE_RELAY);
-       options.set_skip (offset);
+        query += " OFFSET " + offset;
+        options.set_skip (offset);
         options.set_count(50);
         print ("populateItems:", query);
         grilo.tracker.query(
diff --git a/src/query.js b/src/query.js
index 4403ef9..b132baf 100644
--- a/src/query.js
+++ b/src/query.js
@@ -19,11 +19,11 @@
 
 const Tracker = imports.gi.Tracker;
 
-const album = 'SELECT rdf:type(?album) tracker:id(?album) as id (SELECT nmm:artistName(?artist) WHERE { 
?album nmm:albumArtist ?artist } LIMIT 1) AS artist nie:title(?album) as title nie:title(?album) as album 
tracker:coalesce( (SELECT GROUP_CONCAT(nmm:artistName(?artist), ",") WHERE { ?album nmm:albumArtist ?artist 
}), (SELECT GROUP_CONCAT((SELECT nmm:artistName(nmm:performer(?_12)) as perf WHERE { ?_12 nmm:musicAlbum 
?album } GROUP BY ?perf), ",") as album_performer WHERE { }) ) as author 
xsd:integer(tracker:coalesce(nmm:albumTrackCount(?album), (SELECT COUNT(?_1) WHERE { ?_1 nmm:musicAlbum 
?album; tracker:available "true" }))) as childcount (SELECT fn:year-from-dateTime(?c) WHERE { ?_2 
nmm:musicAlbum ?album; nie:contentCreated ?c; tracker:available "true" } LIMIT 1) as publishing-date { ?album 
a nmm:MusicAlbum FILTER (EXISTS { ?_3 nmm:musicAlbum ?album; tracker:available "true" }) } ORDER BY 
?album_artist ?albumyear nie:title(?album)';
+const album = 'SELECT DISTINCT rdf:type(?album) tracker:id(?album) as id (SELECT nmm:artistName(?artist) 
WHERE { ?album nmm:albumArtist ?artist } LIMIT 1) AS artist nie:title(?album) as title nie:title(?album) as 
album tracker:coalesce( (SELECT GROUP_CONCAT(nmm:artistName(?artist), ",") WHERE { ?album nmm:albumArtist 
?artist }), (SELECT GROUP_CONCAT((SELECT nmm:artistName(nmm:performer(?_12)) as perf WHERE { ?_12 
nmm:musicAlbum ?album } GROUP BY ?perf), ",") as album_performer WHERE { }) ) as author 
xsd:integer(tracker:coalesce(nmm:albumTrackCount(?album), (SELECT COUNT(?_1) WHERE { ?_1 nmm:musicAlbum 
?album; tracker:available "true" }))) as childcount (SELECT fn:year-from-dateTime(?c) WHERE { ?_2 
nmm:musicAlbum ?album; nie:contentCreated ?c; tracker:available "true" } LIMIT 1) as publishing-date { ?album 
a nmm:MusicAlbum FILTER (EXISTS { ?_3 nmm:musicAlbum ?album; tracker:available "true" }) } ORDER BY 
?album_artist ?albumyear nie:title(?album)';
 
 const album_count = 'SELECT COUNT(?album) AS childcount WHERE { ?album a nmm:MusicAlbum }';
 
-const songs = 'SELECT rdf:type(?song) tracker:id(?song) as id nie:url(?song) as url nie:title(?song) as 
title nmm:artistName(nmm:performer(?song)) as artist nie:title(nmm:musicAlbum(?song)) as album 
nfo:duration(?song) as duration { ?song a nmm:MusicPiece } ORDER BY tracker:added(?song)';
+const songs = 'SELECT DISTINCT rdf:type(?song) tracker:id(?song) as id nie:url(?song) as url 
nie:title(?song) as title nmm:artistName(nmm:performer(?song)) as artist nie:title(nmm:musicAlbum(?song)) as 
album nfo:duration(?song) as duration { ?song a nmm:MusicPiece } ORDER BY tracker:added(?song)';
 
 const songs_count = 'SELECT COUNT(?song) AS childcount WHERE { ?song a nmm:MusicPiece }';
 


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