Page 10 of 11

Re: UMSP Plugin Development

PostPosted: Sat May 04, 2013 11:11 am
by mad_ady
Yes -I've noticed this as well. The wdtv upnp process is very permissive when parsing xml responses and will accept invalid responses (with unescaped characters). The only exception is the id string that needs to be escaped.

Other compliant upnp renderers will reject malformed xmls (like xbmc for example), so if you want your code to be playable on other players you'll need to make the changes discussed earlier (and live with xmlentities).

Re: UMSP Plugin Development

PostPosted: Sat Mar 29, 2014 3:04 pm
by DJArty
Looks like time to return to theme...
Now around Gen3 with Palace. and "&" escaped or not.
Strange things on WD with palace..
On old Live and 1.02 1.05 f/w into UMSP plugins have code with items and containers and ID's with &
e.g. umsp://plugins/name?url=http://url/?page=1&level=logos
normally worked on 1.02, 1.05 - No alarm messages about "..encoded: & should be encoded as &..." from umsp-test.php

Test on Streaming with latest Palace:
No alarm messages about "..encoded: & should be encoded as &..." from umsp-test.php
Worked from umsp-test but dont work on WD SMP - its stuck on containers with & ids.
If remake IDs in plugin to simple (without amp;):
e.g. umsp://plugins/name?url=http://url/?page=1&level=logos
it was normally work on SMP but have alarm message from umsp-test.php and I guess not work on 1.02,1.05 (check it - true) or via UMSP_LAN (dont check it)..

Looks like on UMSP 2.0 was auto convertation from & to & so its double... Need some rule to avoid double-code in one plugin for many platforms...

So, my opinion - UMSP 2.0 not must to do auto convertation from & to & (_xmlentities?) - this must do authors. Then one plugin was work on all platforms and via UMSP_LAN.

1018,1019 commits (recliq, mad_ady) is under great question... This changes not in public released wdlxtv firmwares, so 100% UMSP plugins work now, but if this changes go to public (like Palace) - we have a problem.

Quick fix as I say before :
Code: Select all
function _xmlentities($string) {
//    return str_replace(array("&", "<", ">", "\"", "'"),
//            array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;"), $string);
return $string;

in function-upnp.php or full remove _xmlentities and change $encodedDIDL back to just $prmDIDL

Re: UMSP Plugin Development

PostPosted: Sun Mar 30, 2014 10:25 pm
by mad_ady
I agree, the _xmlentities function creates this mess. The need for it is not to allow unescaped special characters in the XMLs used by UMSP to communicate via DLNA. Those characters are breaking the XMLs sent by the WDTV (even if the WDTV's parser doesn't care), but other DLNA control points discard them as invalid.

At the time I made the implementation I looked for an elegant solution that didn't require any change in the plugins, but I didn't find any. The only option I was left with was to add the double decode option in the script - but this will fail if you send full URLs (or you can fix it by explicitly encoding your URLs before sending them.

I remember trying to add some logic to detect encoded strings and determining if they needed to be encoded or not. As far as I remember it didn't work as expecetd so I abandoned that idea and forced the encoding inside the UMSP code - when creating the xml if I remember correctly.

I'd like to enlist your help to brainstorm other ideas to make this work with fewer changes in user plugins, but while keeping the UMSP_LAN feature (e.g. the XMLs have to be valid).

Re: UMSP Plugin Development

PostPosted: Mon Mar 31, 2014 12:37 am
by DJArty
As I say before plugin authors can look for correct urls,ids with escaped symbols.. and umsp-test.php help him with alarm messages.
What exactly situation need to convert into funcs-upnp.php, but cannot be converted before into source umsp plugin (one time for all platforms, avoid double decode etc.)?

Re: UMSP Plugin Development

PostPosted: Mon Mar 31, 2014 12:59 am
by mad_ady
So you're saying that I should escape the parameters when building the xml and unescape them when getting the response. I don't remember if I tried this... I'll have to look it up in the code. I think I tried it, but something broke - again, it's been almost 2 years since I made the changes...

Re: UMSP Plugin Development

PostPosted: Mon Mar 31, 2014 1:14 am
by DJArty
:) exactly I say :
I want as developer use ids, urls, titles like this:
Code: Select all
(with &amp; &lt; , &quot; etc.) one time and this work now on 1.02 1.05 and must work on new versions with UMSP2 and LAN

so into funcs-upnp.php just old
Code: Select all
$ndResult = $doc->createElement('Result',$prmDIDL);

without new:
Code: Select all
$encodedDIDL = _xmlentities($prmDIDL);
$ndResult = $doc->createElement('Result', $encodedDIDL);

And can you recommend some Android app to test UPNP/DLNA via WD UMSP_LAN?

Re: UMSP Plugin Development

PostPosted: Mon Mar 31, 2014 1:29 am
by mad_ady
I only tested UMSP_LAN with XBMC. There was a beta for android that worked as well (playback was done with an external player).
I will think about the encoding of parameters. I don't remember exactly why the decoding of the parameters before sending them to the plugin didn't work...

Re: UMSP Plugin Development

PostPosted: Tue Aug 05, 2014 11:07 pm
by mehimu

https in $items['res']

PostPosted: Sun Feb 22, 2015 3:35 pm
by avkiev
As I can see - $items['res'] supports only 2 schemes: http:// and file://
True ?
Is it possible to add support of "https://" ?
Any workaround ?

Re: UMSP Plugin Development

PostPosted: Sun Feb 22, 2015 11:30 pm
by mad_ady
As far as I know you can use https. The playback engine needs to be able to support it, and if there are no problems with certificates, there should be no issue. For example many of my plugins have folder images stored on picasa web and have https links for res.