[rygel] tracker: Skip empty artist, album and genre



commit b869b64109ac2ecb79aaf380636189c3c86399fe
Author: Jens Georg <mail jensge org>
Date:   Thu Jul 28 18:06:55 2011 +0200

    tracker: Skip empty artist, album and genre
    
    While predicate functions seem to generate a nice (null), DBus seems
    to translate it to an empty string. This needs to be revisited when
    finally doing the libtracker-sparql port.
    
    Fixes DLNA requirement 7.3.66.2.

 .../tracker/rygel-tracker-music-item-factory.vala  |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index 59bbcf9..4283fa6 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -117,9 +117,20 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
             music.track_number = int.parse (track_number);
         }
 
-        music.artist = metadata[MusicMetadata.AUDIO_ARTIST];
-        music.album = metadata[MusicMetadata.AUDIO_ALBUM];
-        music.genre = metadata[MusicMetadata.AUDIO_GENRE];
+        // FIXME: For the following three properties:
+        // Once converted to libtracker-sparql, check for null again.
+        // DBus translates a (null) to ''
+        if (metadata[MusicMetadata.AUDIO_ARTIST] != "") {
+            music.artist = metadata[MusicMetadata.AUDIO_ARTIST];
+        }
+
+        if (metadata[MusicMetadata.AUDIO_ALBUM] != "") {
+            music.album = metadata[MusicMetadata.AUDIO_ALBUM];
+        }
+
+        if (metadata[MusicMetadata.AUDIO_GENRE] != "") {
+            music.genre = metadata[MusicMetadata.AUDIO_GENRE];
+        }
 
         music.lookup_album_art ();
     }



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