Plugins don't work on OSX?

Discuss third-party additions, plugins and translations for PS3 Media Server

Re: Plugins don't work on OSX?

Postby dummy_user » Tue Dec 21, 2010 8:41 am

I've reached the dead end of dynamic plugin loading using this technique. I've managed to write a running script injecting the discovered plugins into the classpath contained in the plist using the defaults command.

This note seems to be the problem, as the class path doesn't change when the script is being ran by the *.app, but works when being ran when pms isn't running.
Note: Since applications do access the defaults system while they're running, you shouldn't modify the defaults of a running application. If you change a default in a domain that belongs to a running application, the application won't see the change and might even overwrite the default.

I am now looking how to inject all plugins (in a static way) when building the app file, as suggested by chocolateboy.

Anyone knows of another way the jars could be included in the class path? It takes away some sexyness of the plugin system if the plugins have to be known beforehand, but would be a viable solution.
is taconaut again
dummy_user
 
Posts: 33
Joined: Mon Nov 29, 2010 9:03 am

Re: Plugins don't work on OSX?

Postby chocolateboy » Tue Dec 21, 2010 2:24 pm

dummy_user wrote:I am now looking how to inject all plugins (in a static way) when building the app file, as suggested by chocolateboy.


The jarbundler attributes in the first two patches should help with this (e.g. jarbundler/@extraclasspath and/or jarbundler/@vmoptions):

https://code.google.com/p/ps3mediaserve ... ail?id=766
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Plugins don't work on OSX?

Postby dummy_user » Tue Dec 21, 2010 9:13 pm

These changes to the jarbundler task will load the plugins and update.jar from a pms folder at the root of the user directory
Code: Select all
<jarbundler jar="${osx}/${pms.jar}" dir="${osx}" name="PS3 Media Server" signature="PS3M" mainclass="net.pms.PMS" jvmversion="1.6+" icon="${osx}/pms.icns" version="${version}" vmoptions="-Xmx1024M -Xss16M -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar" workingdirectory="$APP_PACKAGE/Contents/Resources/Java">
   <extraclasspathfileset dir="${user.home}\pms">
      <include name="update.jar" />
   </extraclasspathfileset>
   <extraclasspathfileset dir="${user.home}\pms\plugins">
      <!-- list all the plugins here -->
      <include name="MovieInfo.jar" />
   </extraclasspathfileset>
</jarbundler>
is taconaut again
dummy_user
 
Posts: 33
Joined: Mon Nov 29, 2010 9:03 am

Re: Plugins don't work on OSX?

Postby shagrath » Thu Dec 23, 2010 8:16 pm

The best way would be to use a custom classloader to dynamically load plugins at runtime but this kind of technique is always full of surprises with large Java programes and third party libraries
shagrath
Project Lead
 
Posts: 2667
Joined: Wed Jan 14, 2009 1:39 pm

Re: Plugins don't work on OSX?

Postby chocolateboy » Thu Feb 17, 2011 4:45 am

shagrath wrote:The best way would be to use a custom classloader to dynamically load plugins at runtime but this kind of technique is always full of surprises with large Java programes and third party libraries


I've tested and verified that this works with Linux (Ubuntu 10.10) and Windows (XP) and committed it in r502. Mac people: please test and provide feedback.

The quickest way to test is to drop the latest Channel jar file into the plugins dir, then restart PMS and check/confirm that it adds a "Channels" root folder (or check the trace/debug.log).

Developers/early adopters: if possible, please do a full reinstall of PMS (rather than just dropping in a new pms.jar) to prevent plugins loading twice (which is harmless, but not optimal for testing).

This revision also allows the plugins dir path to be set via PMS.conf:

plugins.txt

Code: Select all
You can drop plugins (*.jar files) here or move them to another directory and set

    # Linux, Mac OS X &c.
    plugins = \/path\/to\/plugins\/dir

or:

    # Windows
    plugins = C:\\Path\\To\\Plugins\\Dir

in PMS.conf
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Plugins don't work on OSX?

Postby taconaut » Thu Feb 17, 2011 8:50 am

Cool! With pms-mlx, I have the plugin folder contained in the *.app file configured as the default plugin folder containing built in plugins and would like the user to have the possibility to define his own plugins folder (where he can specify the path himself an would default to e.g. \Users\<user_name>\pms\plugins).
Long story short, it would be nice if we could specify multiple paths.
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1097
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Plugins don't work on OSX?

Postby chocolateboy » Thu Feb 17, 2011 6:38 pm

taconaut wrote:Long story short, it would be nice if we could specify multiple paths.


Patch (and GUI) welcome! :-)
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Plugins don't work on OSX?

Postby taconaut » Thu Feb 17, 2011 11:15 pm

I didn't dare asking for a gui :P Perfect, thanks!

[edit]Oh seems I misread. I could have sworn there was a comma
If you always wanted to have your most recent videos at the top of the folder in the ps3 or wished you could group all videos with the same genre in one folder, have a look at pms-mlx
taconaut
Project Member
 
Posts: 1097
Joined: Sat Apr 11, 2009 12:29 am
Location: Switzerland

Re: Plugins don't work on OSX?

Postby Raptor399 » Thu Mar 10, 2011 12:14 am

I have tested the fix on OSX with r513.
Without a plugins directory defined in PMS.conf, installed plugins are discovered in the standard .app plugins directory.
With the plugins directory defined, they are discovered in that directory.
Works just as expected, test successful.

Side note: backslashes don't seem necessary in PMS.conf when using a forward slash path:

plugins = /Users/raptor/pms/plugins

works just fine.
Thank you for the fix.
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: Plugins don't work on OSX?

Postby chocolateboy » Thu Mar 10, 2011 12:30 am

Raptor399 wrote:Side note: backslashes don't seem necessary in PMS.conf when using a forward slash path


Thanks. Fixed.

Thank you for the fix.


Thanks for the feedback!
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Previous

Return to Additions and Plugins

Who is online

Users browsing this forum: No registered users and 5 guests