IMDb plugin: use the limit given by cinaest as SQL limit
authorPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 25 Nov 2009 16:05:30 +0000 (17:05 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 26 Nov 2009 18:27:53 +0000 (19:27 +0100)
src/imdb/imdb-sqlite.vala
src/plugins/imdb-plugin.vala

index 431807f..b489fdb 100644 (file)
@@ -163,7 +163,7 @@ class IMDbSqlite : Object {
        }
 
        private Cancellable? _cancellable;
-       public async int query (MovieFilter filter, ReceiveMovieFunction receive_movie, Cancellable? cancellable) {
+       public async int query (MovieFilter filter, ReceiveMovieFunction receive_movie, int limit, Cancellable? cancellable) {
                var sql = "SELECT Title, Year, Rating, Genres FROM Movies";
                var sep = " WHERE ";
                Statement stmt;
@@ -195,7 +195,7 @@ class IMDbSqlite : Object {
                if (filter.genres.field != 0) {
                        sql += sep + "Genres&%d = %d".printf (filter.genres.field, filter.genres.field);
                }
-               sql += " ORDER BY Votes DESC LIMIT %d;".printf (100);
+               sql += " ORDER BY Votes DESC LIMIT %d;".printf (limit);
 
                stdout.printf("SQL: \"%s\"\n", sql);
 
index fb0c32a..f3cf05f 100644 (file)
@@ -165,7 +165,7 @@ class IMDBSource : MovieSource {
                                             "cinaest", "imdb.db", null));
 
                _get_callback = callback;
-               yield sqlite.query (filter, receive_movie, cancellable);
+               yield sqlite.query (filter, receive_movie, limit, cancellable);
        }
 
        private void receive_movie (string title, int year, int rating, int genres) {