mmupnp icon indicating copy to clipboard operation
mmupnp copied to clipboard

FR: Lenient mode for XML from bad upnp devices?

Open Tolriq opened this issue 1 year ago • 1 comments

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>&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dlna=&quot;urn:schemas-dlna-org:metadata-1-0/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:sec=&quot;http://www.sec.co.kr/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot;&gt;&lt;item restricted=&quot;1&quot; id=&quot;59a8c0b1-a871-49ef-aa08-c5272bb54035&quot; parentID=&quot;0&quot;&gt;&lt;upnp:album&gt;Make the World Go Round&lt;/upnp:album&gt;&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;&lt;upnp:artist&gt;Sandy B&lt;/upnp:artist&gt;&lt;res duration=&quot;0:03:50.000&quot; protocolInfo=&quot;http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000&quot;&gt;http://XXX:8096/Audio/XXXX/stream.mp3?static=true&amp;amp;dlnaheaders=true&amp;amp;api_key=REDACTED&lt;/res&gt;&lt;upnp:originalTrackNumber&gt;1&lt;/upnp:originalTrackNumber&gt;&lt;upnp:albumArtURI&gt;http://XXXX:41141/XXX&lt;/upnp:albumArtURI&gt;&lt;dc:title&gt;Make the World Go Round (Deep Dish radio edit)&lt;/dc:title&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</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.

Tolriq avatar May 20 '23 12:05 Tolriq

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.

ohmae avatar May 21 '23 03:05 ohmae