[arch-commits] Commit in rhythmbox/trunk (PKGBUILD totem-plparser-api.patch)

Jan de Groot jgc at archlinux.org
Fri Feb 19 15:11:31 UTC 2010


    Date: Friday, February 19, 2010 @ 10:11:30
  Author: jgc
Revision: 69258

upgpkg: rhythmbox 0.12.6-2
Recompile for new totem-plparser

Added:
  rhythmbox/trunk/totem-plparser-api.patch
Modified:
  rhythmbox/trunk/PKGBUILD

--------------------------+
 PKGBUILD                 |   25 ++-
 totem-plparser-api.patch |  290 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 304 insertions(+), 11 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2010-02-19 14:46:18 UTC (rev 69257)
+++ PKGBUILD	2010-02-19 15:11:30 UTC (rev 69258)
@@ -4,32 +4,35 @@
 
 pkgname=rhythmbox
 pkgver=0.12.6
-pkgrel=1
+pkgrel=2
 pkgdesc="An iTunes-like music player/libary"
 arch=('i686' 'x86_64')
 license=('GPL')
 url="http://www.rhythmbox.org"
-depends=('libgpod>=0.7.2' 'libsoup-gnome>=2.28.1' 'gnome-media>=2.28.0' 'totem-plparser>=2.28.1' 'musicbrainz>=2.1.5' 'libmtp>=0.3.7' 'libnotify>=0.4.5' 'lirc-utils' 'desktop-file-utils' 'gstreamer0.10-python>=0.10.16' 'gstreamer0.10-base-plugins' 'gstreamer0.10-good-plugins' 'pygtk>=2.16.0' 'gvfs>=1.4.1' 'hicolor-icon-theme')
-makedepends=('pkgconfig' 'gnome-doc-utils>=0.18.0' 'intltool' 'brasero>=2.28.1')
+depends=('libgpod>=0.7.2' 'libsoup-gnome>=2.29.90' 'gnome-media>=2.28.5' 'totem-plparser>=2.29.1' 'musicbrainz>=2.1.5' 'libmtp>=0.3.7' 'libnotify>=0.4.5' 'lirc-utils' 'desktop-file-utils' 'gstreamer0.10-python>=0.10.17' 'gstreamer0.10-base-plugins' 'gstreamer0.10-good-plugins' 'pygtk>=2.17.0' 'gvfs>=1.5.3' 'hicolor-icon-theme')
+makedepends=('pkgconfig' 'gnome-doc-utils>=0.18.0' 'intltool' 'brasero>=2.29.90')
 optdepends=('gstreamer0.10-ugly-plugins: Extra media codecs'
             'gstreamer0.10-bad-plugins: Extra media codecs'
             'gstreamer0.10-ffmpeg: Extra media codecs'
             'brasero: cd burning'
             'gnome-python: various plugins'
-	    'pywebkitgtk: needed for context panel plugin'
-	    'python-mako: needed for context panel plugin')
+            'pywebkitgtk: context panel plugin'
+            'python-mako: context panel plugin')
 options=('!libtool' '!emptydirs')
 install=rhythmbox.install
-source=(http://ftp.gnome.org/pub/GNOME/sources/${pkgname}/0.12/${pkgname}-${pkgver}.tar.bz2)
-sha256sums=('ddffa5b7e0e0fe81044354998fd91a58d4ff526746b17a6b638e0e8ea1ac9684')
+source=(http://ftp.gnome.org/pub/GNOME/sources/${pkgname}/0.12/${pkgname}-${pkgver}.tar.bz2
+        totem-plparser-api.patch)
+sha256sums=('ddffa5b7e0e0fe81044354998fd91a58d4ff526746b17a6b638e0e8ea1ac9684'
+            '5fd30bb1812cfeccdc78714c6ccc42a3c8296aa939f9cc5a5e65991cacf6015f')
 
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
+  patch -Np1 -i "${srcdir}/totem-plparser-api.patch" || return 1
   ./configure --prefix=/usr --sysconfdir=/etc \
-              --libexecdir=/usr/lib/rhythmbox \
-              --localstatedir=/var --disable-static \
-              --enable-daap --enable-python \
-              --with-mdns=avahi --disable-scrollkeeper || return 1
+      --libexecdir=/usr/lib/rhythmbox \
+      --localstatedir=/var --disable-static \
+      --enable-daap --enable-python \
+      --with-mdns=avahi --disable-scrollkeeper || return 1
 
   make || return 1
   make GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 DESTDIR="${pkgdir}" install || return 1

Added: totem-plparser-api.patch
===================================================================
--- totem-plparser-api.patch	                        (rev 0)
+++ totem-plparser-api.patch	2010-02-19 15:11:30 UTC (rev 69258)
@@ -0,0 +1,290 @@
+From a6e3370a200215ddd931d04ab684dcda79dceb7b Mon Sep 17 00:00:00 2001
+From: Carlos Garnacho <carlos at lanedo.com>
+Date: Thu, 28 Jan 2010 12:10:14 +0000
+Subject: Use new totem_pl_parser_save API where required
+
+---
+diff --git a/plugins/generic-player/rb-generic-player-playlist-source.c b/plugins/generic-player/rb-generic-player-playlist-source.c
+index 0dfe26f..2ef328b 100644
+--- a/plugins/generic-player/rb-generic-player-playlist-source.c
++++ b/plugins/generic-player/rb-generic-player-playlist-source.c
+@@ -70,6 +70,61 @@ impl_save_to_xml (RBPlaylistSource *source, xmlNodePtr node)
+ 	/* do nothing; just to prevent weirdness */
+ }
+ 
++#if TOTEM_PL_PARSER_CHECK_VERSION(2,29,1)
++
++typedef struct {
++	RBGenericPlayerPlaylistSource *source;
++	TotemPlPlaylist *playlist;
++} SavePlaylistData;
++
++static void
++set_field_from_property (TotemPlPlaylist *playlist,
++			 TotemPlPlaylistIter *iter,
++			 RhythmDBEntry *entry,
++			 RhythmDBPropType property,
++			 const char *field)
++{
++	const char *value;
++
++	value = rhythmdb_entry_get_string (entry, property);
++	if (value != NULL) {
++		totem_pl_playlist_set (playlist, iter, field, value, NULL);
++	}
++}
++
++static gboolean
++save_playlist_foreach (GtkTreeModel *model,
++		       GtkTreePath *path,
++		       GtkTreeIter *iter,
++		       SavePlaylistData *data)
++{
++	RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (data->source);
++	RhythmDBEntry *entry;
++	TotemPlPlaylistIter pl_iter;
++	const char *host_uri;
++	char *uri;
++
++	entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (model), iter);
++	if (entry == NULL) {
++		return FALSE;
++	}
++
++	host_uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
++	uri = rb_generic_player_source_uri_to_playlist_uri (priv->player_source, host_uri);
++
++	totem_pl_playlist_append (data->playlist, &pl_iter);
++	totem_pl_playlist_set (data->playlist, &pl_iter, TOTEM_PL_PARSER_FIELD_URI, uri, NULL);
++	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_ARTIST, TOTEM_PL_PARSER_FIELD_AUTHOR);
++	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_GENRE, TOTEM_PL_PARSER_FIELD_GENRE);
++	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_ALBUM, TOTEM_PL_PARSER_FIELD_ALBUM);
++	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_TITLE, TOTEM_PL_PARSER_FIELD_TITLE);
++
++	g_free (uri);
++	return FALSE;
++}
++
++#else
++
+ static void
+ save_playlist_entry (GtkTreeModel *model, GtkTreeIter *iter,
+ 		     char **uri, char **title,
+@@ -92,6 +147,8 @@ save_playlist_entry (GtkTreeModel *model, GtkTreeIter *iter,
+ 	*custom_title = TRUE;
+ }
+ 
++#endif
++
+ /* this probably belongs more in totem than here */
+ static const char *
+ playlist_format_extension (TotemPlParserType playlist_type)
+@@ -122,9 +179,15 @@ save_playlist (RBGenericPlayerPlaylistSource *source)
+ 	TotemPlParserType playlist_type;
+ 	RhythmDBQueryModel *query_model;
+ 	char *name;
+-	char *temp_uri;
++	char *temp_path;
+ 	GError *error = NULL;
+ 	RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (source);
++	GFile *file;
++	gboolean result;
++#if TOTEM_PL_PARSER_CHECK_VERSION(2,29,1)
++	TotemPlPlaylist *playlist;
++	SavePlaylistData data;
++#endif
+ 
+ 	priv->save_playlist_id = 0;
+ 	playlist_type = rb_generic_player_source_get_playlist_format (priv->player_source);
+@@ -173,42 +236,60 @@ save_playlist (RBGenericPlayerPlaylistSource *source)
+ 		g_object_unref (dir);
+ 	}
+ 
+-	temp_uri = g_strdup_printf ("%s%06X", priv->playlist_path, g_random_int_range (0, 0xFFFFFF));
++	temp_path = g_strdup_printf ("%s%06X", priv->playlist_path, g_random_int_range (0, 0xFFFFFF));
++	file = g_file_new_for_path (temp_path);
+ 
+ 	parser = totem_pl_parser_new ();
++#if TOTEM_PL_PARSER_CHECK_VERSION(2,29,1)
++	playlist = totem_pl_playlist_new ();
++	data.source = source;
++	data.playlist = playlist;
++
++	gtk_tree_model_foreach (GTK_TREE_MODEL (query_model),
++				(GtkTreeModelForeachFunc) save_playlist_foreach,
++				&data);
++	if (rb_debug_matches ("totem_pl_parser_save", "totem-pl-parser.c")) {
++		g_object_set (parser, "debug", TRUE, NULL);
++	}
++
++	result = totem_pl_parser_save (parser, playlist, file, name, playlist_type, &error);
++	g_object_unref (playlist);
++#else
+ 	if (rb_debug_matches ("totem_pl_parser_write_with_title", "totem-pl-parser.c")) {
+ 		g_object_set (parser, "debug", TRUE, NULL);
+ 	}
+-	if (totem_pl_parser_write_with_title (parser,
+-					      GTK_TREE_MODEL (query_model),
+-					      (TotemPlParserIterFunc) save_playlist_entry,
+-					      temp_uri,
+-					      name,
+-					      playlist_type,
+-					      source,
+-					      &error) == FALSE) {
++
++	result = totem_pl_parser_write_with_title (parser,
++						   GTK_TREE_MODEL (query_model),
++						   (TotemPlParserIterFunc) save_playlist_entry,
++						   temp_path,
++						   name,
++						   playlist_type,
++						   source,
++						   &error);
++#endif
++	if (result == FALSE) {
+ 		/* XXX report this more usefully */
+ 		g_warning ("Playlist save failed: %s", error->message);
+ 	} else {
+ 		GFile *dest;
+-		GFile *src;
+ 
+ 		dest = g_file_new_for_path (priv->playlist_path);
+-		src = g_file_new_for_path (temp_uri);
+-		g_file_move (src, dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NO_FALLBACK_FOR_MOVE, NULL, NULL, NULL, &error);
++		g_file_move (file, dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NO_FALLBACK_FOR_MOVE, NULL, NULL, NULL, &error);
+ 		if (error != NULL) {
+ 			/* XXX report this more usefully */
+-			g_warning ("Replacing playlist failed: %s", error->message);
++			g_warning ("moving %s => %s failed: %s", temp_path, priv->playlist_path, error->message);
+ 		}
+ 
+ 		g_object_unref (dest);
+-		g_object_unref (src);
+ 	}
+ 
+ 	g_clear_error (&error);
+ 	g_free (name);
+-	g_free (temp_uri);
++	g_free (temp_path);
+ 	g_object_unref (query_model);
++	g_object_unref (parser);
++	g_object_unref (file);
+ 
+ 	return FALSE;
+ }
+diff --git a/sources/rb-playlist-source.c b/sources/rb-playlist-source.c
+index 7b2bbc0..a1349d0 100644
+--- a/sources/rb-playlist-source.c
++++ b/sources/rb-playlist-source.c
+@@ -567,6 +567,52 @@ rb_playlist_source_drop_cb (GtkWidget *widget,
+ 	gtk_drag_finish (context, TRUE, FALSE, time);
+ }
+ 
++#if TOTEM_PL_PARSER_CHECK_VERSION(2,29,1)
++
++static void
++set_field_from_property (TotemPlPlaylist *playlist,
++			 TotemPlPlaylistIter *iter,
++			 RhythmDBEntry *entry,
++			 RhythmDBPropType property,
++			 const char *field)
++{
++	const char *value;
++
++	value = rhythmdb_entry_get_string (entry, property);
++	if (value != NULL) {
++		totem_pl_playlist_set (playlist, iter, field, value, NULL);
++	}
++}
++
++static gboolean
++playlist_iter_foreach (GtkTreeModel *model,
++		       GtkTreePath *path,
++		       GtkTreeIter *iter,
++		       TotemPlPlaylist *playlist)
++{
++	TotemPlPlaylistIter pl_iter;
++	RhythmDBEntry *entry;
++
++	gtk_tree_model_get (model, iter, 0, &entry, -1);
++	if (entry == NULL) {
++		return FALSE;
++	}
++
++	totem_pl_playlist_append (playlist, &pl_iter);
++	set_field_from_property (playlist, &pl_iter, entry, RHYTHMDB_PROP_LOCATION, TOTEM_PL_PARSER_FIELD_URI);
++	set_field_from_property (playlist, &pl_iter, entry, RHYTHMDB_PROP_ARTIST, TOTEM_PL_PARSER_FIELD_AUTHOR);
++	set_field_from_property (playlist, &pl_iter, entry, RHYTHMDB_PROP_GENRE, TOTEM_PL_PARSER_FIELD_GENRE);
++	set_field_from_property (playlist, &pl_iter, entry, RHYTHMDB_PROP_ALBUM, TOTEM_PL_PARSER_FIELD_ALBUM);
++	set_field_from_property (playlist, &pl_iter, entry, RHYTHMDB_PROP_TITLE, TOTEM_PL_PARSER_FIELD_TITLE);
++
++	/* could possibly set duration, file size.. ? */
++
++	return FALSE;
++}
++
++
++#else
++
+ static void
+ playlist_iter_func (GtkTreeModel *model,
+ 		    GtkTreeIter *iter,
+@@ -594,6 +640,8 @@ playlist_iter_func (GtkTreeModel *model,
+ 	}
+ }
+ 
++#endif
++
+ /**
+  * rb_playlist_source_save_playlist:
+  * @source: a #RBPlaylistSource
+@@ -608,15 +656,19 @@ rb_playlist_source_save_playlist (RBPlaylistSource *source,
+ 				  const char *uri,
+ 				  RBPlaylistExportType export_type)
+ {
+-	TotemPlParser *playlist;
++	TotemPlParser *pl;
+ 	GError *error = NULL;
+ 	char *name;
+ 	gint totem_format;
++#if TOTEM_PL_PARSER_CHECK_VERSION(2,29,1)
++	TotemPlPlaylist *playlist;
++	GFile *file;
++#endif
+ 
+ 	g_return_if_fail (RB_IS_PLAYLIST_SOURCE (source));
+ 
+ 	rb_debug ("saving playlist");
+-	playlist = totem_pl_parser_new ();
++	pl = totem_pl_parser_new ();
+ 
+ 	g_object_get (source, "name", &name, NULL);
+ 
+@@ -633,11 +685,23 @@ rb_playlist_source_save_playlist (RBPlaylistSource *source,
+ 		break;
+ 	}
+ 
+-	totem_pl_parser_write_with_title (playlist, GTK_TREE_MODEL (source->priv->model),
++#if TOTEM_PL_PARSER_CHECK_VERSION(2,29,1)
++	file = g_file_new_for_uri (uri);
++	playlist = totem_pl_playlist_new ();
++
++	gtk_tree_model_foreach (GTK_TREE_MODEL (source->priv->model),
++				(GtkTreeModelForeachFunc)playlist_iter_foreach,
++				playlist);
++	totem_pl_parser_save (pl, playlist, file, name, totem_format, &error);
++	g_object_unref (playlist);
++	g_object_unref (file);
++#else
++	totem_pl_parser_write_with_title (pl, GTK_TREE_MODEL (source->priv->model),
+ 					  playlist_iter_func, uri, name,
+ 					  totem_format,
+ 					  NULL, &error);
+-	g_object_unref (playlist);
++#endif
++	g_object_unref (pl);
+ 	g_free (name);
+ 	if (error != NULL) {
+ 		rb_error_dialog (NULL, _("Couldn't save playlist"),
+--
+cgit v0.8.3.1




More information about the arch-commits mailing list