rpms/rhythmbox/devel rb-ipod-save-artwork.patch, NONE, 1.1 rhythmbox.spec, 1.172, 1.173

Bastien Nocera (hadess) fedora-extras-commits at redhat.com
Tue Mar 4 17:19:15 UTC 2008


Author: hadess

Update of /cvs/pkgs/rpms/rhythmbox/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6288

Modified Files:
	rhythmbox.spec 
Added Files:
	rb-ipod-save-artwork.patch 
Log Message:
* Tue Mar 04 2008 - Bastien Nocera <bnocera at redhat.com> - 0.11.4-11
- Add patch to save the album artwork onto the iPod (#435952)


rb-ipod-save-artwork.patch:

--- NEW FILE rb-ipod-save-artwork.patch ---
--- trunk/plugins/ipod/rb-ipod-source.c	2008/01/01 14:11:29	5526
+++ trunk/plugins/ipod/rb-ipod-source.c	2008/01/02 12:08:13	5527
@@ -48,15 +48,11 @@
 #include "rhythmdb.h"
 #include "rb-cut-and-paste-code.h"
 
-static GObject *rb_ipod_source_constructor (GType type,
+static GObject *rb_ipod_source_constructor (GType type, 
 					    guint n_construct_properties,
 					    GObjectConstructParam *construct_properties);
 static void rb_ipod_source_dispose (GObject *object);
 
-static GObject *rb_ipod_source_constructor (GType type, guint n_construct_properties,
-			       GObjectConstructParam *construct_properties);
-static void rb_ipod_source_dispose (GObject *object);
-
 static gboolean impl_show_popup (RBSource *source);
 static void impl_move_to_trash (RBSource *asource);
 static void rb_ipod_load_songs (RBiPodSource *source);
@@ -82,6 +78,11 @@
 					 const gchar *extension);
 static gchar* ipod_path_from_unix_path (const gchar *mount_point,
 					const gchar *unix_path);
+static gboolean rb_ipod_song_artwork_add_cb (RhythmDB *db,
+                                             RhythmDBEntry *entry,
+                                             const gchar *property_name,
+                                             const GValue *metadata,
+                                             RBiPodSource *isource);
 #endif
 static RhythmDB *get_db_for_source (RBiPodSource *source);
 
@@ -108,6 +109,13 @@
 	GQueue *offline_plays;
 } RBiPodSourcePrivate;
 
+#ifdef ENABLE_IPOD_WRITING
+typedef struct {
+	RBiPodSourcePrivate *priv;
+	GdkPixbuf *pixbuf;
+} RBiPodSongArtworkAddData;
+#endif
+
 RB_PLUGIN_DEFINE_TYPE(RBiPodSource,
 		      rb_ipod_source,
 		      RB_TYPE_REMOVABLE_MEDIA_SOURCE)
@@ -186,6 +194,15 @@
 
 	rb_ipod_load_songs (source);
 
+#ifdef ENABLE_IPOD_WRITING                                      
+        RhythmDB *db = get_db_for_source (RB_IPOD_SOURCE (source));
+        g_signal_connect_object (db,
+                                 "entry-extra-metadata-notify::rb:coverArt",
+                                 G_CALLBACK (rb_ipod_song_artwork_add_cb),
+                                 RB_IPOD_SOURCE(source), 0);
+        g_object_unref (G_OBJECT (db));
+#endif
+
 	return G_OBJECT (source);
 }
 
@@ -1140,6 +1157,82 @@
 	g_hash_table_remove (priv->artwork_request_map, entry);
 }
 
+static gboolean
+rb_add_artwork_whole_album_cb (GtkTreeModel *query_model,
+			       GtkTreePath *path,
+			       GtkTreeIter *iter,
+			       RBiPodSongArtworkAddData *artwork_data)
+{
+	RhythmDBEntry *entry;
+	Itdb_Track *song;	
+	
+	entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (query_model), iter);
+
+	song = g_hash_table_lookup (artwork_data->priv->entry_map, entry);
+		
+	if (song->has_artwork == 0x01) {		   
+		return FALSE;				
+	}
+	
+	rb_ipod_db_set_thumbnail (artwork_data->priv->ipod_db, song, artwork_data->pixbuf);
+	
+	return FALSE;	
+}			     
+
+static gboolean 
+rb_ipod_song_artwork_add_cb (RhythmDB *db,
+			     RhythmDBEntry *entry,
+			     const gchar *property_name,
+			     const GValue *metadata,
+			     RBiPodSource *isource)			     
+{
+	RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (isource);
+	Itdb_Device *device;
+	Itdb_Track *song;
+	GdkPixbuf *pixbuf;
+	GtkTreeModel *query_model;
+	RBiPodSongArtworkAddData artwork_data;
+		
+	if (metadata == NULL) {
+		return FALSE;
+        }
+
+        if (G_VALUE_HOLDS (metadata, GDK_TYPE_PIXBUF) == FALSE) {
+		return FALSE;
+	}
+
+	song = g_hash_table_lookup (priv->entry_map, entry);		
+        if (song == NULL) {
+                return FALSE;
+        }
+
+	device = rb_ipod_db_get_device (priv->ipod_db);
+	if (device == NULL || itdb_device_supports_artwork (device) == FALSE) {
+		return FALSE;
+	}
+	
+	pixbuf = GDK_PIXBUF (g_value_get_object (metadata));
+	
+	query_model = GTK_TREE_MODEL (rhythmdb_query_model_new_empty (db));
+	
+	rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (query_model),
+				RHYTHMDB_QUERY_PROP_EQUALS,
+				RHYTHMDB_PROP_ARTIST, song->artist,
+				RHYTHMDB_QUERY_PROP_EQUALS,
+				RHYTHMDB_PROP_ALBUM, song->album,
+				RHYTHMDB_QUERY_END);
+				
+	artwork_data.priv = priv;
+	artwork_data.pixbuf = pixbuf;
+				
+	gtk_tree_model_foreach (query_model,
+				(GtkTreeModelForeachFunc) rb_add_artwork_whole_album_cb,
+				&artwork_data);
+				
+	g_object_unref(query_model);
+	return FALSE;
+}
+												
 static void
 request_artwork (RBiPodSource *isource,
 		 RhythmDBEntry *entry,
--- trunk/plugins/ipod/rb-ipod-source.c	2008/01/02 12:08:13	5527
+++ trunk/plugins/ipod/rb-ipod-source.c	2008/01/02 13:34:52	5528
@@ -1169,7 +1169,8 @@
 	entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (query_model), iter);
 
 	song = g_hash_table_lookup (artwork_data->priv->entry_map, entry);
-		
+	g_return_val_if_fail (song != NULL, FALSE);
+
 	if (song->has_artwork == 0x01) {		   
 		return FALSE;				
 	}
@@ -1192,7 +1193,8 @@
 	GdkPixbuf *pixbuf;
 	GtkTreeModel *query_model;
 	RBiPodSongArtworkAddData artwork_data;
-		
+        RhythmDBEntryType entry_type;
+
 	if (metadata == NULL) {
 		return FALSE;
         }
@@ -1210,12 +1212,16 @@
 	if (device == NULL || itdb_device_supports_artwork (device) == FALSE) {
 		return FALSE;
 	}
-	
+
+        g_object_get (G_OBJECT (isource), "entry-type", &entry_type, NULL);
+ 
 	pixbuf = GDK_PIXBUF (g_value_get_object (metadata));
 	
 	query_model = GTK_TREE_MODEL (rhythmdb_query_model_new_empty (db));
 	
 	rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (query_model),
+                                RHYTHMDB_QUERY_PROP_EQUALS,
+                                RHYTHMDB_PROP_ENTRY_ID, entry_type,
 				RHYTHMDB_QUERY_PROP_EQUALS,
 				RHYTHMDB_PROP_ARTIST, song->artist,
 				RHYTHMDB_QUERY_PROP_EQUALS,
@@ -1228,7 +1234,7 @@
 	gtk_tree_model_foreach (query_model,
 				(GtkTreeModelForeachFunc) rb_add_artwork_whole_album_cb,
 				&artwork_data);
-				
+        g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type);	
 	g_object_unref(query_model);
 	return FALSE;
 }
--- trunk/plugins/ipod/rb-ipod-source.c	2008/02/02 19:24:40	5558
+++ trunk/plugins/ipod/rb-ipod-source.c	2008/02/14 14:11:22	5579
@@ -1233,7 +1233,7 @@
 	
 	rhythmdb_do_full_query (db, RHYTHMDB_QUERY_RESULTS (query_model),
                                 RHYTHMDB_QUERY_PROP_EQUALS,
-                                RHYTHMDB_PROP_ENTRY_ID, entry_type,
+                                RHYTHMDB_PROP_TYPE, entry_type,
 				RHYTHMDB_QUERY_PROP_EQUALS,
 				RHYTHMDB_PROP_ARTIST, song->artist,
 				RHYTHMDB_QUERY_PROP_EQUALS,


Index: rhythmbox.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rhythmbox/devel/rhythmbox.spec,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -r1.172 -r1.173
--- rhythmbox.spec	3 Mar 2008 23:17:47 -0000	1.172
+++ rhythmbox.spec	4 Mar 2008 17:18:31 -0000	1.173
@@ -3,7 +3,7 @@
 Name: rhythmbox
 Summary: Music Management Application 
 Version: 0.11.4
-Release: 10%{?dist}
+Release: 11%{?dist}
 License: GPLv2+ and GFDL+
 Group: Applications/Multimedia
 URL: http://www.gnome.org/projects/rhythmbox/
@@ -68,6 +68,9 @@
 # http://bugzilla.gnome.org/show_bug.cgi?id=519737
 Patch6: rb-activate-generic-players-from-uri.patch
 
+# http://bugzilla.gnome.org/show_bug.cgi?id=493996
+Patch7: rb-ipod-save-artwork.patch
+
 %description
 Rhythmbox is an integrated music management application based on the powerful
 GStreamer media framework. It has a number of features, including an easy to
@@ -102,6 +105,7 @@
 %patch4 -p0 -b .gsd
 %patch5 -p0 -b .automake
 %patch6 -p0 -b .player-activate
+%patch7 -p1 -b .ipod-artwork
 
 %build
 autoconf
@@ -219,6 +223,9 @@
 %{_libdir}/rhythmbox/plugins/upnp_coherence
 
 %changelog
+* Tue Mar 04 2008 - Bastien Nocera <bnocera at redhat.com> - 0.11.4-11
+- Add patch to save the album artwork onto the iPod (#435952)
+
 * Mon Mar 03 2008 - Bastien Nocera <bnocera at redhat.com> - 0.11.4-10
 - Add a patch to fix activating audio players with a directory instead
   of a device path (GNOME bug #519737)




More information about the fedora-extras-commits mailing list