PDA

View Full Version : Plugin menus



James
2007-10-29, 14:17
I can see from the RandomPlay plugin how to add a plugin menu to Jive, and also how that menu can have dynamically created sub menus (e.g. the list of genres) by calling cli commands.

Is it possible at this stage to add a menu where the top level itself is dynamically created?

I guess I would like to register a function reference with Slim::Control::Jive::registerPluginMenu() rather than a pre-populated variable. Or possibly a function ref as the value of the 'item_loop'?

James

erland
2007-10-29, 22:21
I can see from the RandomPlay plugin how to add a plugin menu to Jive, and also how that menu can have dynamically created sub menus (e.g. the list of genres) by calling cli commands.

Is it possible at this stage to add a menu where the top level itself is dynamically created?

I guess I would like to register a function reference with Slim::Control::Jive::registerPluginMenu() rather than a pre-populated variable. Or possibly a function ref as the value of the 'item_loop'?

James
In the current code, I think it depends on how ugly you like to get.

If you make sure to keep a reference to the hash you send as parameter in registerPluginMenu, you can actually change it after the call and it affects the menu the next time Jive reads it. I've verfied that this is the case by changing the 'text' item at the top, so I'm pretty sure you also can change the item_loop contents if that is what you like.

You should be aware of two things though:
1. I'm not sure if this is a supported way to do it.
2. Jive doesn't re-read the top menu very often. I've only seen it happens when I turn the player on/off or change player.

For all this to work in a nice way I think we need two things:
1. We need some way to indicate to the Jive remote that it needs to re-read the main menu
2. We need an official way to update an already existing menu, either with a callback or by making it possible to unregister/update it.

Hopefully, Ben or someone else of the developers working with Jive will give us some idea which way they like to go.

As a related note, I've mentioned in another thread that I would like to see it possible to make player specific menus on the Jive remote. For example making the menus structure a lot simpler when connecting to the SB in the kids room compared to when connecting the same remote to the living room SB. To make this work for dynamic menus provided by plugins, I think some kind of callback would be prefered so you can check player states before deciding if a specific menu entry should be available or not on that player. It also requires a way to notify the Jive remote that it needs to re-read the menu configuration when the player state changes.

James
2007-11-04, 15:05
Turns out it's much simpler than I thought!
Although the Random Mix plugin creates and registers its whole top-level menu in advance, you don't need to do that and can just register a call to your plugin's cli function to create the menu on demand.
Another benefit is you do then have a client to work with when building the menu.

James