Plugins: allow returning multiple movies per callback invocation
[cinaest] / src / plugins / moviepilot-plugin.vala
index 43cf94b..27fe167 100644 (file)
@@ -132,6 +132,7 @@ class MoviePilotSource : MovieSource {
        private void on_movies_found (DBus.Object sender, string[] movies, bool finished) {
                print ("found %d movies\n", movies.length);
                var parser = new Json.Parser ();
+               var result = new SList<Movie> ();
 
                for (int i = 0; i < movies.length; i++) {
                        var movie = new Movie ();
@@ -147,9 +148,11 @@ class MoviePilotSource : MovieSource {
                        movie.rating = (int) object.get_double_member ("rating");
                        movie.secondary = object.get_string_member ("genres").replace (",", ", ");
 
-                       callback (movie);
+                       result.append (movie);
                }
 
+               callback (result);
+
                if (finished) {
                        search = null;
                        Idle.add (get_movies_callback);