Embed groovy to PMS runtime?

Discuss issues related to PS3 Media Server development (only for programmers)

Embed groovy to PMS runtime?

Postby glebb » Sat May 26, 2012 8:49 pm

I was experimenting on writing plugins with Groovy. FUN! It worked out quite well, and I think it could be quite useful. I 'd rather write future plugins with Groovy, or at least have the option. Of course, as demonstrated, it can be done even now, but with a cost: you need to embed groovy to your plugin, which is clumsy and makes the jar quite large. Solution would be embed groovy runtime dependency to PMS.

Groovy embedded version of PMS: https://github.com/glebb/ps3mediaserver ... y_embedded. It should be ok to be merged if so wanted.

I think adding Groovy should not be a big problem. It will increase the size of the PMS, but other than that I don't see many negative side effects. I don't think PMS itself should be modified / written in Groovy, but (us) plugin developers might like it.

Here's the plugin written in Groovy: https://github.com/glebb/pms-osx-smartfolder for example.
glebb
 
Posts: 20
Joined: Mon May 21, 2012 4:20 pm
Location: Finland

Re: Embed groovy to PMS runtime?

Postby chocolateboy » Sat May 26, 2012 10:48 pm

If plugin developers want to use Groovy, nothing's stopping them (I use it myself (via Groovy++) for PMSEncoder). There's no reason to bloat the core with it, though, particularly not for one plugin (that only runs on one platform).

The best way to share a dependency like this would be with a library plugin (XBMC has something like this for shared Python libraries). There's nothing to specifically support library plugins in PMS at the moment, but we have some rudimentary (and broken) plugin initialisation ordering that could possibly be fixed/expanded to handle load ordering/dependencies.

It would be easy enough to add support for e.g. "library" resource files to be checked and loaded before "plugin" files in ExternalFactory.java - a lot easier than implementing a full-blown plugin dependency framework. Patches welcome!
chocolateboy
Project Member
 
Posts: 2579
Joined: Wed Sep 16, 2009 10:05 am

Re: Embed groovy to PMS runtime?

Postby glebb » Sun May 27, 2012 7:36 am

Maybe you are right, though I wasn't talking about doing this for one single plugin that runs on one platform. I was carefully trying to start a conversation about making stuff more easy for (new?) devs around PMS to write plugins, maybe even encouraging people to use Groovy for plugin development in the first place? But as you answered my question, it probably doesn't pay off bloating PMS with Groovy. Maybe we (or I) can look into that library resource file approach you hinted about, maybe that's the way to go. BTW, is there any irc channel you are using?

But it's very good to hear that writing plugins with Groovy is ok and already happening in the first place. Unfortunately I didn't learn about PMSEncoder before this thread, it would've helped quite a lot figuring things out :) Do you know if there's more Groovy goodness around?

What actually started this whole thing was me trying to figure out how to write plugins. With the great help of taconaut I got started and was able to produce something that runs. I also started to think about writing some instructions down for others in the same position. Then I started thinking about how to make things easy, and got bedazzled by Groovy. However, I didn't find any common wiki for PMS developers? If somebody could create one, for example to github, I volunteer to write something down about getting started with plugin development (with Groovy). Or I can just blog about it, but I think the info around PMS is already way too scattered. I would still want to make things easier for new devs, embedding Groovy was not the primary goal, and I apologize if I got the message wrong in the first place.
glebb
 
Posts: 20
Joined: Mon May 21, 2012 4:20 pm
Location: Finland

Re: Embed groovy to PMS runtime?

Postby chocolateboy » Sun May 27, 2012 2:19 pm

glebb wrote:Unfortunately I didn't learn about PMSEncoder before this thread, it would've helped quite a lot figuring things out :)


Info about PMS plugins and plugin development can be found by searching the forum (and the source, of course). Plugins are listed here. Previous discussions relating to plugin development and interfaces can be found in this subforum e.g.:


I volunteer to write something down about getting started with plugin development


More documentation, internal or external, is always welcome. We tend to document the high-level stuff in the FAQ and the low(er)-level stuff in-tree (e.g. PMS.conf, WEB.conf, PS3.conf &c.) so e.g. adding a README.md to the plugins directory might be a good place to start. If you don't need the formatting, expanding plugins.txt (even if only with a link to a blog post) or posting a guide on here would be just as good. But the hard part is the writing. :-) Figuring out where to bundle or link it won't be a problem.
chocolateboy
Project Member
 
Posts: 2579
Joined: Wed Sep 16, 2009 10:05 am

Re: Embed groovy to PMS runtime?

Postby glebb » Thu May 31, 2012 10:12 pm

Ok, I wrote some basic instructions about plugin development and setting up the environments for that. Please check & comment https://github.com/glebb/ps3mediaserver ... /README.md

I can do pull request later if the content is ok.
glebb
 
Posts: 20
Joined: Mon May 21, 2012 4:20 pm
Location: Finland

Re: Embed groovy to PMS runtime?

Postby chocolateboy » Thu May 31, 2012 11:01 pm

Looks good.

glebb wrote:I can do pull request later if the content is ok.


Please do.
chocolateboy
Project Member
 
Posts: 2579
Joined: Wed Sep 16, 2009 10:05 am


Return to Developers

Who is online

Users browsing this forum: No registered users and 6 guests