[rhythmbox] shell-player: store embedded cover art images in album-art extdb



commit 8bf6155f6bd910db855d5c3c5a042465d10627a5
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Dec 17 00:19:21 2011 +1000

    shell-player: store embedded cover art images in album-art extdb

 shell/rb-shell-player.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/shell/rb-shell-player.c b/shell/rb-shell-player.c
index 2dfeead..01854fe 100644
--- a/shell/rb-shell-player.c
+++ b/shell/rb-shell-player.c
@@ -84,6 +84,7 @@
 #include "rb-podcast-manager.h"
 #include "rb-marshal.h"
 #include "rb-missing-plugins.h"
+#include "rb-ext-db.h"
 
 /* Play Orders */
 #include "rb-play-order-linear.h"
@@ -3716,21 +3717,29 @@ player_image_cb (RBPlayer *player,
 		 GdkPixbuf *image,
 		 RBShellPlayer *shell_player)
 {
-	GValue v = {0,};
+	RBExtDB *store;
+	RBExtDBKey *key;
+	const char *artist;
+	GValue v = G_VALUE_INIT;
 
-	if (image == NULL) {
+	if (image == NULL)
 		return;
+
+	store = rb_ext_db_new ("album-art");
+
+	key = rb_ext_db_key_create ("album", rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM));
+	artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM_ARTIST);
+	if (artist == NULL || artist[0] == '\0' || strcmp (artist, _("Unknown")) == 0) {
+		artist = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ARTIST);
 	}
+	rb_ext_db_key_add_field (key, "album-artist", RB_EXT_DB_FIELD_OPTIONAL, artist);
 
 	g_value_init (&v, GDK_TYPE_PIXBUF);
 	g_value_set_object (&v, image);
-
-	rhythmdb_emit_entry_extra_metadata_notify (shell_player->priv->db,
-						   entry,
-						   "rb:coverArt",
-						   &v);
+	rb_ext_db_store (store, key, RB_EXT_DB_SOURCE_EMBEDDED, &v);
 	g_value_unset (&v);
 
+	g_object_unref (store);
 }
 
 /**



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