[libdmapsharing] Fix issues related to sort names and iTunes '09



commit 51761a02b4391d765ac071b00fe9a306478b16db
Author: W. Michael Petullo <mike flyn org>
Date:   Wed May 19 23:43:35 2010 -0500

    Fix issues related to sort names and iTunes '09
    
    Protect against NULL artist or album sort names. Start adding support for
    iTunes '09. See also https://bugzilla.gnome.org/show_bug.cgi?id=616669,
    Move DAAP code to use common libdmapsharing for more information on
    the former.

 ChangeLog                   |    5 +++++
 TODO                        |    7 +++++++
 libdmapsharing/daap-share.c |   10 ++++++++--
 libdmapsharing/dpap-share.c |    8 ++++++++
 media/Makefile.am           |    3 ++-
 5 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index aef71db..b151435 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+18 May 2010 W. Michael Petullo <mike flyn org>
+
+	* Add another case to dpap-share.c:build_filter() in an attempt
+	to support iTunes '09.
+
 16 May 2010 W. Michael Petullo <mike flyn org>
 
 	* Documentation work.
diff --git a/TODO b/TODO
index 3bf35ef..c9537f7 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,10 @@
+iTunes '09, segfault:
+	dmap_container_record_get_entry_count:86
+	_dmap_share_add_playlist_to_mlcl:1016
+
+Combine daap- and dpap-share.c filter parser (see filterstr). USE DPAP's
+BECUASE IT IS NEWER!
+
 Ensure client test catches newly shared files?
 
 Do transcode based on client?
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index 91fc642..6a8f867 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -698,12 +698,18 @@ add_entry_to_mlcl (gpointer id, DMAPRecord *record, gpointer _mb)
 	if (_dmap_share_client_requested (mb->bits, SONG_SORT_ARTIST)) {
 		gchar *sort_artist;
 		g_object_get (record, "sort-artist", &sort_artist, NULL);
-		dmap_structure_add (mlit, DMAP_CC_ASSA, sort_artist);
+		if (sort_artist)
+			dmap_structure_add (mlit, DMAP_CC_ASSA, sort_artist);
+		else
+			g_warning ("Sort artist requested but not available");
 	}
 	if (_dmap_share_client_requested (mb->bits, SONG_SORT_ALBUM)) {
 		gchar *sort_album;
 		g_object_get (record, "sort-album", &sort_album, NULL);
-		dmap_structure_add (mlit, DMAP_CC_ASSU, sort_album);
+		if (sort_album)
+			dmap_structure_add (mlit, DMAP_CC_ASSU, sort_album);
+		else
+			g_warning ("Sort album requested but not available");
 	}
 
 
diff --git a/libdmapsharing/dpap-share.c b/libdmapsharing/dpap-share.c
index 5b8ffdb..036321e 100644
--- a/libdmapsharing/dpap-share.c
+++ b/libdmapsharing/dpap-share.c
@@ -481,12 +481,20 @@ build_filter (gchar *filterstr)
          * 'dmap.itemid:1000','dmap:itemid:1001'
 	 * or
 	 * 'daap.songgenre:Foo'+'daap.songartist:Bar'+'daap.songalbum:Baz'
+	 * or (iPhoto '09)
+	 * ('daap.idemid:1000','dmap:itemid:1001')
          */
 
+	size_t len;
 	GSList *list = NULL;
 
 	g_debug ("Filter string is %s.", filterstr);
 
+	len = strlen (filterstr);
+	filterstr = *filterstr == '(' ? filterstr + 1 : filterstr;
+	/* FIXME: I thought this should be -1, but there is a trailing ' ' in iTunes '09: */
+	filterstr[len - 2] = filterstr[len - 2] == ')' ? 0x00 : filterstr[len - 2];
+
 	if (filterstr != NULL) {
 		int i;
 		gchar **t1 = g_strsplit (filterstr, ",", 0);
diff --git a/media/Makefile.am b/media/Makefile.am
index d1abfae..5a87268 100644
--- a/media/Makefile.am
+++ b/media/Makefile.am
@@ -1,4 +1,5 @@
 EXTRA_DIST = 			\
 	test.jpeg		\
 	another-test.png	\
-	test.mp3
+	test.mp3		\
+	another-test.mp3



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