File noise-0.4.2-gst.patch of Package noise

diff -ruN noise-0.4.2.orig/src/GStreamer/CoverImport.vala noise-0.4.2/src/GStreamer/CoverImport.vala
--- noise-0.4.2.orig/src/GStreamer/CoverImport.vala	2017-11-27 19:02:59.000000000 +0300
+++ noise-0.4.2/src/GStreamer/CoverImport.vala	2018-03-24 05:29:26.386097981 +0300
@@ -35,7 +35,6 @@
     construct {
         try {
             discoverer = new Gst.PbUtils.Discoverer ((Gst.ClockTime) (DISCOVERER_TIMEOUT * Gst.SECOND));
-            discoverer.discovered.connect (import_media);
         } catch (Error err) {
             critical ("Could not create Gst discoverer object: %s", err.message);
         }
@@ -43,16 +42,22 @@
 
     public CoverImport (Album album) {
         this.album = album;
-        foreach (var media in album.get_media ()) {
-            discoverer.discover_uri_async (media.uri);
-        }
-    }
-
-    public void start () {
-        discoverer.start ();
+        new Thread<void*>(null, () => {
+            lock (this.album) {
+                foreach (var media in album.get_media ()) {
+                    try {
+                        var info = discoverer.discover_uri (media.uri);
+                        read_info (info);
+                    } catch (Error err) {
+                        critical ("Error while importing cover for %s: %s", album.name, err.message);
+                    }
+                }
+            }
+            return null;
+        });
     }
 
-    private void import_media (Gst.PbUtils.DiscovererInfo info, Error err) {
+    private void read_info (Gst.PbUtils.DiscovererInfo info) {
         string uri = info.get_uri ();
         bool gstreamer_discovery_successful = false;
         switch (info.get_result ()) {
@@ -65,7 +70,7 @@
             break;
 
             case Gst.PbUtils.DiscovererResult.ERROR:
-                warning ("GStreamer could not import '%s': %s", uri, err.message);
+                warning ("GStreamer could not import '%s'", uri);
             break;
 
             case Gst.PbUtils.DiscovererResult.TIMEOUT:
@@ -102,9 +107,9 @@
                 if (buffer != null) {
                     pixbuf = get_pixbuf_from_buffer (buffer);
                     if (pixbuf != null) {
-                        album.save_cover_pixbuf (pixbuf);
-                        debug ("Cover imported for '%s'", info.get_uri ());
-                        discoverer.stop ();
+                        lock (album) {
+                            album.save_cover_pixbuf (pixbuf);
+                        }
                     }
                 }
 
@@ -151,9 +156,9 @@
         } catch (Error err) {
             warning ("Error processing image data: %s", err.message);
         }
- 
+
         buffer.unmap (map_info);
- 
+
         return pix;
     }
 }
diff -ruN noise-0.4.2.orig/src/GStreamer/GStreamerTagger.vala noise-0.4.2/src/GStreamer/GStreamerTagger.vala
--- noise-0.4.2.orig/src/GStreamer/GStreamerTagger.vala	2017-11-27 19:02:59.000000000 +0300
+++ noise-0.4.2/src/GStreamer/GStreamerTagger.vala	2018-03-24 06:15:31.523855164 +0300
@@ -86,7 +86,7 @@
         });
     }
 
-    private void import_media (Gst.PbUtils.DiscovererInfo info, Error err) {
+    private void import_media (Gst.PbUtils.DiscovererInfo info, Error? err) {
         if (cancellable.is_cancelled ()) {
             d.stop ();
             lock (uri_queue) {
diff -ruN noise-0.4.2.orig/src/LocalBackend/LocalLibrary.vala noise-0.4.2/src/LocalBackend/LocalLibrary.vala
--- noise-0.4.2.orig/src/LocalBackend/LocalLibrary.vala	2017-11-27 19:02:59.000000000 +0300
+++ noise-0.4.2/src/LocalBackend/LocalLibrary.vala	2018-03-24 05:37:19.803720112 +0300
@@ -740,8 +740,9 @@
     }
 
     public override void add_medias (Gee.Collection<Media> new_media) {
-        if (new_media.is_empty) // happens more often than you would think
-            return;
+        if (new_media.is_empty) {// happens more often than you would think
+             return;
+        }
 
         // make a copy of the media list so that it doesn't get modified before
         // the async code (e.g. updating the smart playlists) is done with it
@@ -752,20 +753,19 @@
                                                   (Gee.EqualDataFunc<int64?>?)GLib.int64_equal, null);
         foreach (var m in media) {
             var local_m = new LocalMedia.from_media (connection, m);
-            local_media.set (local_m.rowid, local_m);
+            local_media[local_m.rowid] = local_m;
             // Append the media into an album.
             if (local_m.get_album_hashkey () in album_info.keys) {
-                var album = album_info.get (local_m.get_album_hashkey ());
+                var album = album_info[local_m.get_album_hashkey ()];
                 album.add_media (local_m);
             }
 
             if (local_m.album_info == null) {
                 var album = new Album.from_media (local_m);
                 album.add_media (local_m);
-                album_info.set (album.get_hashkey (), album);
+                album_info[album.get_hashkey ()] = album;
                 if (album.cover_icon == null) {
-                    var cover_import = new CoverImport (album);
-                    cover_import.start ();
+                    new CoverImport (album);
                 }
             }
         }
openSUSE Build Service is sponsored by