mmupnp
mmupnp copied to clipboard
FR: Lenient mode for XML from bad upnp devices?
Long time no one bothered you here :p Still enjoying your library :)
I'm facing an issue with a few devices that return invalid XML and wonder if there a way to add a lenient mode to support them or a way for me to intercept the answer and rewrite it before it's parsed by MMupnp?
<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetPositionInfoResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><Track>1</Track><TrackDuration>0:00:00</TrackDuration><TrackMetaData><DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:sec="http://www.sec.co.kr/" xmlns:dc="http://purl.org/dc/elements/1.1/"><item restricted="1" id="59a8c0b1-a871-49ef-aa08-c5272bb54035" parentID="0"><upnp:album>Make the World Go Round</upnp:album><upnp:class>object.item.audioItem.musicTrack</upnp:class><upnp:artist>Sandy B</upnp:artist><res duration="0:03:50.000" protocolInfo="http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000">http://XXX:8096/Audio/XXXX/stream.mp3?static=true&amp;dlnaheaders=true&amp;api_key=REDACTED</res><upnp:originalTrackNumber>1</upnp:originalTrackNumber><upnp:albumArtURI>http://XXXX:41141/XXX</upnp:albumArtURI><dc:title>Make the World Go Round (Deep Dish radio edit)</dc:title></item></DIDL-Lite></TrackMetaData><TrackURI>http://XXXX:8096/Audio/XXXX/stream.mp3?static=true&dlnaheaders=true&api_key=REDACTED</TrackURI><RelTime>0:00:00</RelTime><AbsTime>0:00:00</AbsTime><RelCount>0</RelCount><AbsCount>0</AbsCount></u:GetPositionInfoResponse></s:Body></s:Envelope>
The track URI does not have the & escaped causing mmupnp to fail on such answers.
That's too serious a violation for XML. That's difficult... I think one way would be to provide a way to rewrite, as you say. I'll try to see if there's a way, but I can't say it's possible. Also, as you can see, I haven't been able to update this library recently. I don't know when the next update will be.