After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686464 - Add XML fragments getter methods to GUPnPDIDLLiteObject
Add XML fragments getter methods to GUPnPDIDLLiteObject
Status: RESOLVED FIXED
Product: gupnp-av
Classification: Other
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-19 13:20 UTC by cguiraud
Modified: 2019-02-22 05:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add-XML-fragments-getter-methods-to-GUPnPDIDLLiteObj (11.69 KB, patch)
2012-10-19 13:23 UTC, cguiraud
needs-work Details | Review
patch v2 (11.47 KB, patch)
2012-10-24 15:46 UTC, cguiraud
committed Details | Review

Description cguiraud 2012-10-19 13:20:43 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.
Comment 1 cguiraud 2012-10-19 13:23:14 UTC
Created attachment 226823 [details] [review]
Add-XML-fragments-getter-methods-to-GUPnPDIDLLiteObj

patch proposal for this enhancement
Comment 2 Krzesimir Nowak 2012-10-24 15:06:16 UTC
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.
Comment 3 cguiraud 2012-10-24 15:46:39 UTC
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.