[libdmapsharing] Send artist and album sort order to DAAP clients



commit c3f8959a29fb8a889df1583b2bf34a198c96bb96
Author: W. Michael Petullo <mike flyn org>
Date:   Thu May 6 18:23:26 2010 -0500

    Send artist and album sort order to DAAP clients
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616669
    Signed-off-by: W. Michael Petullo <mike flyn org>

 distro/libdmapsharing.spec       |    5 ++++-
 docs/libdmapsharing-docs.sgml    |    1 -
 libdmapsharing/daap-record.c     |   14 ++++++++++++++
 libdmapsharing/daap-share.c      |   15 +++++++++++++++
 libdmapsharing/dmap-connection.c |   17 ++++++++++++++---
 libdmapsharing/dmap-structure.c  |    3 +++
 libdmapsharing/dmap-structure.h  |    2 ++
 7 files changed, 52 insertions(+), 5 deletions(-)
---
diff --git a/distro/libdmapsharing.spec b/distro/libdmapsharing.spec
index 90e322c..7dc6b04 100644
--- a/distro/libdmapsharing.spec
+++ b/distro/libdmapsharing.spec
@@ -1,5 +1,5 @@
 Name: libdmapsharing
-Version: 1.9.0.14
+Version: 1.9.0.16
 Release: 1%{?dist}
 License: LGPLv2+
 Source: http://downloads.sourceforge.net/%name/%{name}-%{version}.tar.gz
@@ -58,6 +58,9 @@ rm -rf $RPM_BUILD_ROOT
 %postun -p /sbin/ldconfig
 
 %changelog
+* Sun Apr 04 2010 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.16-1
+- New upstream version.
+
 * Sun Nov 29 2009 W. Michael Petullo <mike[ ]flyn org> - 1.9.0.14-1
 - New upstream version.
 
diff --git a/docs/libdmapsharing-docs.sgml b/docs/libdmapsharing-docs.sgml
index 393b6e6..2b16098 100644
--- a/docs/libdmapsharing-docs.sgml
+++ b/docs/libdmapsharing-docs.sgml
@@ -32,7 +32,6 @@
 
   <chapter>
     <title>Libdmapsharing Objects and Interfaces</title>
-    <xi:include href="xml/daap-connection.xml"/>
     <xi:include href="xml/daap-record.xml"/>
     <xi:include href="xml/daap-share.xml"/>
     <xi:include href="xml/dmap-connection.xml"/>
diff --git a/libdmapsharing/daap-record.c b/libdmapsharing/daap-record.c
index 73a7fa5..765cc1d 100644
--- a/libdmapsharing/daap-record.c
+++ b/libdmapsharing/daap-record.c
@@ -52,6 +52,13 @@ daap_record_init (DAAPRecordInterface *iface)
 					     G_PARAM_READWRITE));
 
 		g_object_interface_install_property (iface,
+			g_param_spec_string ("sort-album",
+					     "Album sort name",
+					     "Album sort name",
+					     "Unknown",
+					     G_PARAM_READWRITE));
+
+		g_object_interface_install_property (iface,
 			g_param_spec_string ("artist",
 					     "Song artist",
 					     "Song artist",
@@ -59,6 +66,13 @@ daap_record_init (DAAPRecordInterface *iface)
 					     G_PARAM_READWRITE));
 
 		g_object_interface_install_property (iface,
+			g_param_spec_string ("sort-artist",
+					     "Song artist sort name",
+					     "Song artist sort name",
+					     "Unknown",
+					     G_PARAM_READWRITE));
+
+		g_object_interface_install_property (iface,
 			g_param_spec_string ("genre",
 					     "Song genre",
 					     "Song genre",
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index 87a9d65..91fc642 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -368,6 +368,8 @@ typedef enum {
 	SONG_RELATIVE_VOLUME,
 	SONG_SAMPLE_RATE,
 	SONG_SIZE,
+	SONG_SORT_ALBUM,
+	SONG_SORT_ARTIST,
 	SONG_START_TIME,
 	SONG_STOP_TIME,
 	SONG_TIME,
@@ -413,6 +415,8 @@ static struct DMAPMetaDataMap meta_data_map[] = {
     	{"daap.songtracknumber",	SONG_TRACK_NUMBER},
     	{"daap.songuserrating",		SONG_USER_RATING},
     	{"daap.songyear",		SONG_YEAR},
+	{"daap.sortalbum",		SONG_SORT_ALBUM},
+	{"daap.sortartist",		SONG_SORT_ARTIST},
 	{"com.apple.itunes.has-video",	SONG_HAS_VIDEO}};
 
 #define DAAP_ITEM_KIND_AUDIO 2
@@ -691,6 +695,17 @@ add_entry_to_mlcl (gpointer id, DMAPRecord *record, gpointer _mb)
 		g_object_get (record, "has-video", &has_video, NULL);
 		dmap_structure_add (mlit, DMAP_CC_AEHV, has_video);
 	}
+	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 (_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);
+	}
+
 
 	return;
 }
diff --git a/libdmapsharing/dmap-connection.c b/libdmapsharing/dmap-connection.c
index 7335909..7937c6b 100644
--- a/libdmapsharing/dmap-connection.c
+++ b/libdmapsharing/dmap-connection.c
@@ -952,6 +952,8 @@ handle_song_listing (DMAPConnection *connection,
 		const gchar *format = NULL;
 		const gchar *genre = NULL;
 		const gchar *streamURI = NULL;
+		const gchar *sort_artist = NULL;
+		const gchar *sort_album = NULL;
 		gint length = 0;
 		gint track_number = 0;
 		gint disc_number = 0;
@@ -1004,6 +1006,12 @@ handle_song_listing (DMAPConnection *connection,
 				case DMAP_CC_ASUL:
 					streamURI = g_value_get_string (&(meta_item->content));
 					break;
+				case DMAP_CC_ASSA:
+					sort_artist = g_value_get_string (&(meta_item->content));
+					break;
+				case DMAP_CC_ASSU:
+					sort_album = g_value_get_string (&(meta_item->content));
+					break;
 				default:
 					break;
 			}
@@ -1044,6 +1052,8 @@ handle_song_listing (DMAPConnection *connection,
 			     "album", album,
 			     "artist", artist,
 			     "genre", genre,
+			     "sort-artist", sort_artist,
+			     "sort-album", sort_album,
 			      NULL);
 		g_hash_table_insert (priv->item_id_to_uri, GINT_TO_POINTER (item_id), g_strdup (uri));
 		g_free (uri);
@@ -1556,10 +1566,11 @@ dmap_connection_do_something (DMAPConnection *connection)
 		g_debug ("Getting DAAP song listing");
 		path = g_strdup_printf ("/databases/%i/items?session-id=%u&revision-number=%i"
 				        "&meta=dmap.itemid,dmap.itemname,daap.songalbum,"
-					"daap.songartist,daap.daap.songgenre,daap.songsize,"
+					"daap.songartist,daap.songgenre,daap.songsize,"
 					"daap.songtime,daap.songtrackcount,daap.songtracknumber,"
-					"daap.songyear,daap.songformat,daap.songgenre,"
-					"daap.songbitrate,daap.songdiscnumber,daap.songdataurl",
+					"daap.songyear,daap.songformat,"
+					"daap.songbitrate,daap.songdiscnumber,daap.songdataurl,"
+					"daap.sortartist,daap.sortalbum",
 					priv->database_id,
 					priv->session_id,
 					priv->revision_number);
diff --git a/libdmapsharing/dmap-structure.c b/libdmapsharing/dmap-structure.c
index f225589..4608bf7 100644
--- a/libdmapsharing/dmap-structure.c
+++ b/libdmapsharing/dmap-structure.c
@@ -111,6 +111,8 @@ static const DMAPContentCodeDefinition cc_defs[] = {
     {DMAP_CC_ASYR, MAKE_CONTENT_CODE('a','s','y','r'), "daap.songyear", "asyr", DMAP_TYPE_SHORT},
     {DMAP_CC_ASDK, MAKE_CONTENT_CODE('a','s','d','k'), "daap.songdatakind", "asdk", DMAP_TYPE_BYTE},
     {DMAP_CC_ASUL, MAKE_CONTENT_CODE('a','s','u','l'), "daap.songdataurl", "asul", DMAP_TYPE_STRING},
+    {DMAP_CC_ASSU, MAKE_CONTENT_CODE('a','s','s','u'), "daap.sortalbum", "assu", DMAP_TYPE_STRING},
+    {DMAP_CC_ASSA, MAKE_CONTENT_CODE('a','s','s','a'), "daap.sortartist", "assa", DMAP_TYPE_STRING},
     {DMAP_CC_APLY, MAKE_CONTENT_CODE('a','p','l','y'), "daap.databaseplaylists", "aply", DMAP_TYPE_CONTAINER},
     {DMAP_CC_ABPL, MAKE_CONTENT_CODE('a','b','p','l'), "daap.baseplaylist", "abpl", DMAP_TYPE_BYTE},
     {DMAP_CC_APSO, MAKE_CONTENT_CODE('a','p','s','o'), "daap.playlistsongs", "apso", DMAP_TYPE_CONTAINER},
@@ -597,6 +599,7 @@ dmap_structure_add (GNode *parent,
 	va_start (list, cc);
 
 	dmap_type = dmap_content_code_dmap_type (cc);
+	g_print ("%d %d %d %d\n\n\n", dmap_type, cc, DMAP_TYPE_SHORT, DMAP_TYPE_STRING);
 	gtype = dmap_content_code_gtype (cc);
 
 	item = g_new0(DMAPStructureItem, 1);
diff --git a/libdmapsharing/dmap-structure.h b/libdmapsharing/dmap-structure.h
index 385c3d2..dbd6000 100644
--- a/libdmapsharing/dmap-structure.h
+++ b/libdmapsharing/dmap-structure.h
@@ -110,6 +110,8 @@ typedef enum {
 	DMAP_CC_ASYR,
 	DMAP_CC_ASDK,
 	DMAP_CC_ASUL,
+	DMAP_CC_ASSU,
+	DMAP_CC_ASSA,
 	DMAP_CC_APLY,
 	DMAP_CC_ABPL,
 	DMAP_CC_APSO,



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