Sign up here and you can log into the forum!

UMSP Plugin Development

Discussion, features, plugins--everything about zoster's UMSP UPnP Media Server software

UMSP Plugin Development   

Postby CrashX » Mon Jun 21, 2010 8:37 am

I have a couple of questions regarding UMSP plugin development:-

1) Where are php print/error_log/exit messages stored ?
-> I couldn't find in /tmp/php/error_log or web server logs

2) Are global or session variables wiped after each function call to _pluginMain ?

3) Do we need to have "_" before each function name ? ie function _pluginCreateList()
CrashX
Global Moderator
 
Posts: 143
Joined: Thu Apr 15, 2010 9:04 am

Re: UMSP Plugin Development   

Postby zoster » Tue Jun 22, 2010 8:09 am

1) The echo/print/exit functions write directly to the web server output. The error_log output is defined in /etc/php/.../php.ini and should write to /tmp/php/
I use my custom _var_dump_to_file function for any debugging output (it writes to /tmp/umsp-log.txt). If you're using the beta fw the php errors appear in the apache log.

2) Globals are wiped with every call of control-reply.php which I guess is what you mean in this case. I've never tried the session stuff, since I prefer the RESTful way (i.e. passing variables via the umsp:// pseudo URL)

3) No. The underscore is just a personal habit to quickly differentiate between standard and user defined functions.
zoster
WDLXTV Team
 
Posts: 218
Joined: Wed Apr 14, 2010 10:14 am

Re: UMSP Plugin Development   

Postby CrashX » Tue Jun 22, 2010 11:59 pm

Just an update to my findings on beta firmware:

1) Print/echo messages don't get output to logs as their sent via web page output.
2) error_log messages gets updated to /var/log/php5/error_log. Currently the file 'error_log' has the wrong premission set, and hence can't be overwritten. b-rad said he will fix it to 666.
3) php script error messages appear at /var/log/appache2/error.log.
CrashX
Global Moderator
 
Posts: 143
Joined: Thu Apr 15, 2010 9:04 am

Re: UMSP Plugin Development   

Postby CrashX » Sat Jul 10, 2010 12:52 pm

Couple of more questions if you don't mind:

1) I noticed that you can run UMSP plugins locally according to the code but I can't seem to get it to work ? I tried the following:
umsp://local/boot/test.php
-> Placed that file test.php in usb drive and change _pluginMain to _localMain but it still doesn't work.

2) How can I get UMSP to be detected outside the localhost by other media clients ie XBMC ?
CrashX
Global Moderator
 
Posts: 143
Joined: Thu Apr 15, 2010 9:04 am

Re: UMSP Plugin Development   

Postby zoster » Sat Jul 10, 2010 4:08 pm

1. 'Local' means local media, not plugins.

2. Writing a full fledged, standard compliant UPnP media server would require a lot of additional code.
zoster
WDLXTV Team
 
Posts: 218
Joined: Wed Apr 14, 2010 10:14 am

Re: UMSP Plugin Development   

Postby Jo2003 » Wed Oct 06, 2010 1:45 am

Hello!

I'm trying to implement some additional functionality to an existing plugin (kartina.tv - russian IPTV).

Some questions related the "RESTful" way (passing variables using pseudo URL):
  • In some plugin functions http_build_query is used to create such a http query. What argument separator should be used? & or &? I got trouble when using more then one arg=val pair. In that case _pluginMain doesn't get the submitted query string. So maybe the separator is the problem?
  • I have a global class which handles authentication at the iptv provider (and other stuff like EPG handling). Since all global stuff is wiped out, is there a way to serialize this class instance and pass it as parameter? Or must I instantiate the class in every function it is used?

Best regards,
Jo2003
Jo2003
Developer
 
Posts: 32
Joined: Wed Jul 14, 2010 6:00 am
Location: Germany

Re: UMSP Plugin Development   

Postby zoster » Wed Oct 06, 2010 3:25 am

The http_build_query separator should work when left at default (&). Maybe you have some additional ampersands in your values? Check the raw $prmQuery value.
Afaik all encoding issues have been fixed. Are you using an older firmware?
If you're testing on a Xampp system make sure to explicitly set the separator to "&" as for some reason Xampp (and maybe others) default to "&".

Regarding object serialization: I don't use any OOP aspects in PHP but have a look here.
zoster
WDLXTV Team
 
Posts: 218
Joined: Wed Apr 14, 2010 10:14 am

Re: UMSP Plugin Development   

Postby Jo2003 » Wed Oct 06, 2010 3:39 am

Thanks for the quick answer. I'm using 0.4.2.2, and also have tried 0.4.2.8.
In error case the $prmQuery was empty as well. I'll have a deeper look today.

Thinkung about the serialization of the class ... the whole problem in my case is, that I don't want to authenticate every time I request something from the provider. So it should be enough to pass this authentication (Session ID) as parameter to any function which should use the class. In that case I could instantiate the class witout the "overhead" of authentication. I'll try it and let you know.

Best regards,
Jo2003
Jo2003
Developer
 
Posts: 32
Joined: Wed Jul 14, 2010 6:00 am
Location: Germany

Re: UMSP Plugin Development   

Postby Jo2003 » Wed Oct 06, 2010 11:55 am

If I use more than one arg=val pair I get following error listed in phps error log:
Code: Select all
[06-Oct-2010 21:46:43] PHP Warning:  XMLReader::read() [<a href='xmlreader.read
'>xmlreader.read</a>]:
                       ^ in /usr/share/umsp/funcs-upnp.php on line 6
[06-Oct-2010 21:46:43] PHP Warning:  XMLReader::read() [<a href='xmlreader.read
'>xmlreader.read</a>]: An Error Occured while reading in /usr/share/umsp/funcs-
upnp.php on line 6
[06-Oct-2010 21:46:43] PHP Fatal error:  Uncaught exception 'DOMException' with
message 'Namespace Error' in /usr/share/umsp/funcs-upnp.php:154
Stack trace:
#0 /usr/share/umsp/funcs-upnp.php(154): DOMDocument->createElementNS('urn:schem
as-upn...', '')
#1 /usr/share/umsp/control-reply.php(101): _createSOAPEnvelope('<?xml version="
...', 0, 0, NULL)
#2 {main}
  thrown in /usr/share/umsp/funcs-upnp.php on line 154


e.g. I use following code in a function:
Code: Select all
         $data       = array('action' => 'arch_main',
                             'cid'    => $channels->item($i)->nodeValue);
                             
         $dataString = http_build_query($data);
         
         $retMediaItems[] = array (
            'id'             => LOC_KARTINA_UMSP."/http-stream?".$dataString,
            'dc:title'       => $names->item($i)->nodeValue,
            'upnp:class'     => 'object.container',
            'upnp:album_art' => KARTINA_HOST.$icons->item($i)->nodeValue
         );

... the error appears.

Best regards,
Jo2003
Jo2003
Developer
 
Posts: 32
Joined: Wed Jul 14, 2010 6:00 am
Location: Germany

Re: UMSP Plugin Development   

Postby zoster » Wed Oct 06, 2010 1:59 pm

I would separate the XML parsing from the other functions and check/debug it. DOM can throw all kinds of nasty stuff. Without the rest of the code I can't really tell.
zoster
WDLXTV Team
 
Posts: 218
Joined: Wed Apr 14, 2010 10:14 am

Next

Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 2 guests

cron