![]() |
|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
GroovyPlugins: A scripting platform for plugins (design discussion)
I talked the other day about writing a plugin entirely in Groovy. Groovy plugins are nice, but they still have to be compiled into bytecode in order for the core to load them.
Today, I'm ready to announce the bigger picture: GroovyPlugins. This will provide the ability to write SageTV plugins in Groovy script without the need to compile them down into bytecode! Furthermore, if properly written, such plugins can be modified while they're running and the code changes are immediately picked up and deployed. Even if you choose not to put the effort into supporting dynamic code mods, most code changes to these Groovy script based plugins will not require a SageTV restart! I'm running a build on my test server and it's actually running way better than I ever expected, but it's going to be a little while before I'm comfortable putting something out there for people. However, I've started my documentation (albeit a little thin right now) and I'm looking for two things: 1) Is there any interest in such a platform? 2) If you are interested, please read the linked to docs above for a few more details and let me know if there are any features/functionality you'd like to see offered?
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#2
|
|||
|
|||
I am not a developer but I must say that this is a great concept. The one good thing in Sage6 was the Jetty apps that you wrote, as well as jreichen's, etc were so easy to implement since you didn't have to restart anything. I like the plugin manager in Sage7 but it seems like 99% of plugins require a Sage restart which is a pain in the ass - I rarely have the luxury of being able to shut down Sage until the family are in bed.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server |
#3
|
||||
|
||||
Quote:
![]() I agree that installing plugins and restarting is not convenient, which is why I only install update plugins once a week, and then I only do it when the system is not in use. It's like applying updates to Windows or installing software on Windows... you know it's going to require a restart, so you don't do it while you absolutely need the machine to remain up. Keep in mind... Just because a plugin has been updated... doesn't mean that you need the update. If you are running fine, without issues, then I'd probably not install a plugin update until your scheduled update cycle.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#4
|
||||
|
||||
Slugger,
I think this is a very interesting idea. Saving me from restarts while I am developing plugins would be welcome. My only request is that it's Linux friendly. Let me know if you want testers. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#5
|
|||
|
|||
Quote:
![]() Quote:
The other bonus is that the barrier to entry for plugin development is lowered. More people should be able to write plugins in Groovy as opposed to Java. Especially when they start with your AbstractPlugin as the base. ![]() Quote:
![]() Ultimately, the motivation here is to provide two key elements for myself: 1) A platform to write plugins solely in Groovy script, without the need to compile to bytecode for the Sage core to consume; I can turnover a plugin in Groovy way faster than an equivalent effort in Java. 2) Provide a "hot deploy" environment that can be used to modify plugins as they're running in the same JVM as Sage. This, for example, allows me to use GKusnick's strongly typed API, if so desired, in an env that doesn't require a constant rebuild/redeploy/restart of SageTV on every code change. Also allows access to parts of the API that just aren't available via the remote APIs (via RMI).
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#6
|
|||
|
|||
Quote:
![]()
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#7
|
||||
|
||||
I've got the same setup: Ubuntu for my test server, WinXP Home for my production server.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#8
|
||||
|
||||
Slugger, while isn't aimed at myself... I did notice in the docs that you are going to require a license for this... I'm just curious.. .is this a developer license, ie a developer can write X number of plugins or does this mean a user that installs a plugin that is using your groovy scripting may be required to buy a license. I hope it's first and not the latter... if it's the latter, then it'll be like playing Plugin Roulette
![]() Also, about a couple years back, I looked at adding Scripting (Javascript at the time) to the sagex apis for the purpose of allowing STV development without needing a restart. This turned out to be more a pipe dream for me, since which i could write code in script, there was no way to actually invoke that code from the STV ![]()
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#9
|
|||
|
|||
Quote:
I'm leaning towards not applying the license to the platform plugin. Doing so might possibly require(**) a user to donate for a license to run a plugin from another dev who doesn't want donations applied. I don't like that scenario at all and it would also most likely discourage devs from trying Groovy as a plugin platform. Most likely, there will no license required for this platform plugin. ** I hate saying "require's a license" because it really isn't the case. Any and all plugins that are restricted functionally without a sagetv-addons license can be fully unlocked without a license by anyone willing to download and build the source code themselves. It's all open source, it's all openly available. Quote:
Alternatively, one could actually dynamically compile these .groovy files at runtime and add them to the Sage classpath. (* See EDIT below) I won't be doing that, but a plugin could do it. My intent is that each plugin is a standalone thread of execution and common/public classes are precompiled and installed in the JARs folder, if necessary. EDIT: Don't quote me on that. I speak only in theory. I really haven't investigated that claim too thoroughly, but in theory it should be possible. In practice, however, I have no intention of trying to implement it in the slightest way. ![]()
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... Last edited by Slugger; 04-16-2011 at 08:31 AM. |
#10
|
||||
|
||||
That's been my experience with using scripting... ie, the script has access to everything in the sagetv classpath, but the STV or other plugins can't access the script.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#11
|
||||
|
||||
I would add that just because a plugin has been updated doesn't mean the update works better than the version you have. Any update can potentially destabilize your system, so if you have recordings in progress that you don't want to interrupt, you really shouldn't be downloading plugin updates anyway until the recordings are done and you have time to test the updates. So I don't see hot deployment as a big boon to end users (at least not to sensibly cautious end users). Its primary value (in my view) is to speed up the plugin development cycle.
__________________
-- Greg |
#12
|
||||
|
||||
Quote:
__________________
-- Greg |
#13
|
|||
|
|||
Quote:
However, if one were to write a proxy server to dispatch the function calls into the .groovy files then you could achieve this such that a restart would only be required if the dispatcher itself was modified. But then we're talking about layers on top of layers. It's interesting you question the desire of end users to have plugins that update without a required restart. I actually got thinking about that this afternoon while I was out. I kind of came to the same conclusion. And as I review what I've created so far, it seems I've just added a level of indirection/abstraction to the plugin model that will only cause headaches if it were found to be buggy in anyway. The benefit of having the ability to redeploy without a compile/restart is good, but to support that feature requires writing your plugin in such away that the .groovy files can be monitored and reloaded at runtime and those .groovy files aren't directly referenced in your SageTVPlugin implementation. There's just enough indirection required in the approach that anything more than a simple/basic plugin would almost become tied to the platform, which I thought was ok, but now I realize that I probably don't want to support the platform. Eclipse + Remote APIs provides a sufficient enough environment for most of what I do and what it doesn't provide I can probably live without in the dev env. Think I might shelf this idea for awhile and come back to it later, unless there's an overwhelming desire from other devs in the community. The actual launcher of the plugins is written and working. I'm at the point where I'm trying to massage the plugin config options to dynamically load the plugin config options for the GroovyPlugins. Basically, it is a sort of plugin manager on it's own where you install GroovyPlugins into a special dir and my plugin finds them, starts them, stops them and updates them as needed. The more I realize just what I'm creating, the more I realize I don't really want to create a separate plugin manager. ![]()
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#14
|
||||
|
||||
Well, I wasn't trying to talk you out of it, just pointing out that the direct benefit of hot deployment to end users is marginal at best. However there could be considerable indirect benefit from a wide variety of lightweight plugins enabled by this sort of technology.
__________________
-- Greg |
#15
|
|||
|
|||
Quote:
And before seeing your thoughts, I already thought that most users don't really care if they're plugins update "hot". Theoretically, plugin updates are so infrequent, relatively speaking, that the burden of a required restart is probably only really felt by developers during development. If we assume that's true then the restrictions/limitations (and work still to be done) to support plugin development in this env isn't really worth it when Eclipse + remote APIs pretty much gives the same thing (in a much more stable, proven env). Hot deploy Groovy plugins was actually really easy compared to where I am right now with the code: How do I trick my plugin's config STV screen into loading up each GroovyPlugin's config screen on demand? Because these GroovyPlugins people would write would not be installed within the Sage plugin manager. Instead, if you were to put them in the Sage repository you'd have to label it a General plugin with no implementation class so that Sage itself doesn't ever try to start it, but instead leave that management to my platform. Well, originally I was going to just say manually config these plugins via props files, etc. I didn't like that so then I started down the road of manipulating the parent plugin (mine) into actually reading and displaying each GroovyPlugin's config opts from the bootstrap class. I was able to find them, but trying to get the config screen to dynamically load was becoming a headache. That's when I realized I was actually getting myself into the "Another Plugin Manager" business, which I don't want to do. This, combined with the fact that most users probably don't care about hot deploy anyways, is what has lead me to probably shelf this for a little while. ![]()
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
SJQv4: Design Discussion | Slugger | SageTV v7 Customizations | 26 | 10-18-2010 08:22 AM |
Terraterm scripting | mikejaner | The SageTV Community | 8 | 09-28-2010 01:41 PM |
Most Stable Platform | enterpryse | SageTV Software | 34 | 02-26-2009 10:29 PM |
Utility: Sage Scripting Framework | stuckless | SageTV Customizations | 6 | 01-19-2009 01:00 PM |
Possible Extender Platform | exdirtfarmer | SageTV Media Extender | 1 | 09-21-2006 04:25 PM |