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 chocolateboy » Fri Nov 26, 2010 8:41 pm

I guess I didn't make myself clear: someone with a Mac (i.e. not me) should test/tweak this if Mac users want plugins to work.

It may work. It may not. But at the moment, no-one has reported even trying it.
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Plugins don't work on OSX?

Postby RyanEricW » Fri Dec 03, 2010 8:53 pm

We all know macs aren't real computers. lols
RyanEricW
 
Posts: 2
Joined: Fri Dec 03, 2010 8:24 pm

Re: Plugins don't work on OSX?

Postby Hasn » Mon Dec 13, 2010 2:21 pm

Hi chocolateboy,

I put your code in "JavaApplicationStub.setenv" but nothing changed.
Is there any other solution to get plugins work on OSX?

Thank you
Hasn
 
Posts: 4
Joined: Sun Dec 12, 2010 8:33 pm

Re: Plugins don't work on OSX?

Postby dummy_user » Mon Dec 13, 2010 2:42 pm

Even though I don't use the server on OSX, I gave it a try compiling the OSX version with choclateboys script. It didn't work either.
If I run the scrpit (with slight modifications) from the command line, the classpath is being populated correctly.
Now the question is, can anybody tell me how I can get the output of the script ran when launching the *app file to a console, log file or whatever? Some echos in the script should help figuring out what fails.
is taconaut again
dummy_user
 
Posts: 33
Joined: Mon Nov 29, 2010 9:03 am

Re: Plugins don't work on OSX?

Postby chocolateboy » Mon Dec 13, 2010 5:21 pm

dummy_user wrote:can anybody tell me how I can get the output of the script ran when launching the *app file to a console, log file or whatever?


Change the shebang from e.g.

Code: Select all
#!/bin/sh


to:

Code: Select all
#!/bin/sh -x
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Plugins don't work on OSX?

Postby dummy_user » Wed Dec 15, 2010 9:57 am

I've redirected the standard out to a file and noticed two problems

1) working_dir=`pwd` -> results in '\' and thus the plugins directory isn't found at root.
2) if the working_dir is set with the absolute path for the *.app file (to solve 1)), the plugins are being detected if '| paste -s -d':'' is being removed from the script chocolatboy posted. If the classpath is printed out with echo, the list of plugins separated by a white space is being displayed. An echo of '"$here/$cmd" -classpath "$classpath" "$@"' shows each plugin on a new line.. For this point I guess the only thing that has to be corrected is the concatenation of the paths to the jar files (I've given it a try with the string replace function, but am not sure how it should be formatted). Was the paste command supposed to do that??
is taconaut again
dummy_user
 
Posts: 33
Joined: Mon Nov 29, 2010 9:03 am

Re: Plugins don't work on OSX?

Postby chocolateboy » Wed Dec 15, 2010 5:32 pm

dummy_user wrote:Was the paste command supposed to do that??


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

Re: Plugins don't work on OSX?

Postby dummy_user » Sun Dec 19, 2010 11:38 am

I thought this would work..
Code: Select all
#!/bin/sh

# set environment variables here
export LANG=en_US.UTF-8

# execute the real JavaApplicationStub
here="${0%/*}"
cmd="JavaApplicationStub"

working_dir=$HOME/pms
log_dir=$HOME/pms_startup.txt
echo working_dir=$working_dir > $log_dir
classpath="$working_dir/update.jar:$(echo $working_dir/plugins/*.jar | sed 's/ /:/g')"
echo classpath=$classpath >> $log_dir

if [ x"$classpath" != x"" ]; then
   echo execute=$here/$cmd -classpath $classpath "$@" >> $log_dir
   exec "$here/$cmd" -classpath $classpath "$@"
else
   echo execute=$here/$cmd "$@" >> $log_dir
   exec $here/$cmd "$@"
fi

output:
Code: Select all
working_dir=/Users/pw/pms
classpath=/Users/pw/pms/update.jar:/Users/pw/pms/plugins/MovieInfo.jar:/Users/pw/pms/plugins/tmdbrater.jar
execute=/Users/pw/Documents/eclipse/pms/ps3mediaserver/osx/PS3 Media Server.app/Contents/MacOS/JavaApplicationStub -classpath /Users/pw/pms/update.jar:/Users/pw/pms/plugins/MovieInfo.jar:/Users/pw/pms/plugins/tmdbrater.jar -psn_0_18870782

pms starts but no plugins show up. Anybody sees what's going wrong?
is taconaut again
dummy_user
 
Posts: 33
Joined: Mon Nov 29, 2010 9:03 am

Re: Plugins don't work on OSX?

Postby dummy_user » Mon Dec 20, 2010 6:59 pm

It's a bit more complicated then that. The *.app file contains the file Contents/Info.plist which looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>CFBundleName</key>
   <string>PS3 Media Server</string>
   <key>CFBundleShortVersionString</key>
   <string>1.20.412</string>
   <key>CFBundleGetInfoString</key>
   <string>1.20.412</string>
   <key>CFBundleAllowMixedLocalizations</key>
   <string>false</string>
   <key>CFBundleInfoDictionaryVersion</key>
   <string>6.0</string>
   <key>CFBundleExecutable</key>
   <string>JavaApplicationStub.setenv</string>
   <key>CFBundleDevelopmentRegion</key>
   <string>English</string>
   <key>CFBundlePackageType</key>
   <string>APPL</string>
   <key>CFBundleSignature</key>
   <string>PS3M</string>
   <key>CFBundleIconFile</key>
   <string>pms.icns</string>
   <key>Java</key>
   <dict>
      <key>MainClass</key>
      <string>net.pms.PMS</string>
      <key>JVMVersion</key>
      <string>1.6+</string>
      <key>ClassPath</key>
      <array>
         <string>/Users/pw/pms/plugins/MovieInfo.jar</string>
         <string>/Users/pw/pms/update.jar</string>
         <string>$JAVAROOT/pms.jar</string>
      </array>
      <key>VMOptions</key>
      <string>-Xmx1024M -Xss16M -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar</string>
      <key>WorkingDirectory</key>
      <string>$APP_PACKAGE/Contents/Resources/Java</string>
   </dict>
</dict>
</plist>

The class path consists of an array (at the end) which has to be changed by the script on application start to include $JAVAROOT/pms.jar, /Users/ph_waeber/pms/update.jar as well as all discovered plugins. I've got no clue how to write this though; help would be appreciated :)

Manually editing the plist made the plugin load!
is taconaut again
dummy_user
 
Posts: 33
Joined: Mon Nov 29, 2010 9:03 am

Re: Plugins don't work on OSX?

Postby chocolateboy » Mon Dec 20, 2010 7:51 pm

dummy_user wrote:The class path consists of an array (at the end) which has to be changed by the script on application start to include $JAVAROOT/pms.jar, /Users/ph_waeber/pms/update.jar as well as all discovered plugins. I've got no clue how to write this though


Usual disclaimers (I don't have access to a Mac), but it should be possible with e.g. AppleScript or xsltproc (or both):

http://www.latenightsw.com/freeware/PLi ... index.html
http://www.latenightsw.com/freeware/CodeWarrior.html
http://macscripter.net/viewtopic.php?pid=132430#p132430

Another solution would be for someone to package a Mac OS X build that includes all the working plugins. There are only a dozen or so:

viewtopic.php?f=12&t=9078

Or even just configure the Mac build to include the list of all available plugins in its classpath, and leave it to the user to actually install them. The java binary (assuming the stub eventually calls an unmodified java binary) ignores nonexistent paths/files in its classpath (which is why PMS.bat and PMS.sh don't blow up if update.jar is not available).
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

PreviousNext

Return to Additions and Plugins

Who is online

Users browsing this forum: No registered users and 8 guests