GNOME Bugzilla – Bug 686464
Add XML fragments getter methods to GUPnPDIDLLiteObject
Last modified: 2019-02-22 05:57:36 UTC
CDS UpdateObject action works with property xml element fragments. There is currently no way to get properties xml element fragments string from a GUPnPDIDLLiteObject. a possible enhancement would be to add public getter function to get the xml fragment string related to a properties e.g:dc:title, dc:date, upnp:genre, upnp:class, upnp:album, upnp:originalTrackNumber, upnp:artist. example for the title, char * gupnp_didl_lite_object_get_title_xml(GUPnPDIDLLiteObject *object); function would return : <dc:title> My Favorite Song </dc:title> These functions would use xmlNodeDump() function to extract the raw xml. a public function to unset all the artists properties would also be needed in order to allow to update the artists list and get the related xml fragment.
Created attachment 226823 [details] [review] Add-XML-fragments-getter-methods-to-GUPnPDIDLLiteObj patch proposal for this enhancement
Review of attachment 226823 [details] [review]: ::: libgupnp-av/gupnp-didl-lite-object.c @@ +2173,3 @@ + **/ +char * +gupnp_didl_lite_object_get_title_xml_string (GUPnPDIDLLiteObject *object) The code in this function is repeated several times. Please move it to helper function taking the object and element name. Or maybe even move it to XML utils as this function might be useful elsewhere in future. @@ +2349,3 @@ + **/ +char * +gupnp_didl_lite_object_get_artists_xml_string (GUPnPDIDLLiteObject *object) I don't like that get_artists_xml_string and unset_artists, but I see why you wrote them the way they are now. GUPnP-AV is too limited to allow you to simply create GUPnPDIDLLiteContributor and get an XML string from it.
Created attachment 227159 [details] [review] patch v2 I've added an xml utils helper to factorize the code used to extract the xml fragments as recommended by the review.