Skin/plugin interaction
#1
What is the preferred or recommended method to send notifications from a skin to a plugin?

I realize that I can subclass xbmcgui.WindowXML and override the on... functions, but that doesn't work for standard windows. I've tried to subclass xbmcgui.Window with a given ID (0 for the home window for example) but the overrides don't get called (I would have been surprised if they did).

I can use the window properties to pass information, but then I would need to poll them in the plugin with the obvious tradeoff between polling overhead and reaction delay.

Is there any way to trigger a plugin directly, by sending a JSON notification or something like that?
Reply
#2
You could use Runscript and pass stuff to the plugin that way. You'd have to use either button actions or maybe conditional transitions to trigger it, but it should work as long as the plugin is able to handle being called again and again. Here's how artist slideshow is started when the window loads.
Code:
<onload condition="System.HasAddon(script.artistslideshow)">RunScript(script.artistslideshow)</onload>
Reply
#3
Thanks for the quick reply and suggestion, pkscuot!

That would result in a separate instance being created and run every time, or not? I would need to use a separate (lightweight) script for that, again facing the problem of having to notify the original (resident) plugin/add-on.
Reply
#4
It really depends on what your script is/does and what your trying to achieve.

Is it a script, does it create a window or dialog that remains until your script ends, is it an addon that just populates an xbmc list, these will all impact your potential solution?

You may also use the JSON Files.GetDirectory call to trigger an addon;

http://wiki.xbmc.org/?title=JSON-RPC_API...tDirectory

Pass in "directory" and the plugin as the parameters, eg

{"directory":"plugin://plugin.video.youtube"}

You can try this in a browser like this:

http://localhost:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Files.GetDirectory","params":{"directory":"plugin://plugin.video.youtube"}, "id":1}
Reply
#5
What I'm trying to achieve is similar to populating a list and I've considered that approach. Let me explain...

I do like the feature of home menu customization a lot that some skins provide, but dislike the bloat it involves. I've only seen it implemented through mindless repitition, because of a skin's static nature. That also limits the level of customization, depending on what the skin creator considered necessary or useful.

I could use the list provider addon solution for a main menu but would still need to revert to the repititive approach when it comes to submenus (I think it might even sometimes be useful to have a third level). It's also potentially a lot of state to load whenever the home screen is activated.

I'm looking for a way to populate those lists dynamically while the user navigates through the menu structure. That's why I need the skin to notify the addon (I guess it would be called a service? I'm a little uncertain of the terminology here) of the user's activity.
Reply
#6
Would the new dynamic list content be of any help then?

http://wiki.xbmc.org/index.php?title=Dyn...st_Content

There is a thread on here somewhere about this but I can't seem to find it Sad

There is a bit here;
http://forum.xbmc.org/showthread.php?tid=194415

Edit:
Found it!
http://forum.xbmc.org/showthread.php?tid=176864
Reply
#7
(2014-06-23, 20:42)spoyser Wrote: Would the new dynamic list content be of any help then?

I think not. The addon would only be invoked when the control is being set up. If I would like to allow the user to have up to 20 items per menu (still some kind of limitation in my book) and three menu levels, I'd still have to define 420 controls in the skin and call the addon as many times to populate the lists when the home screen is activated.

I could just create the entire menu structure programatically in the addon when the home window is loaded, but the python controls seem to be lacking a lot of the fancy visual options that are accessible through the skin xml, or am I missing something?
Reply
#8
Take a look at my skin shortcuts script, which can provide a whole menu/submenu to a skin via python. Initially it used the dynamic list contents, but this prooved too slow. These days, it writes the menu to the skins directory as an include, which the skin can stick in a list and display as it wants. Might give you some ideas Smile
Reply
#9
Very nice, thanks. Your script didn't come up when I was searching for existing solutions to my problem. I'll certainly check it out.

I also checked the XBMC sources for the NotifyAll built-in function and found out that it takes up to 3 parameters (something the wiki docs don't mention). I will try to see if I can utilize that together with xbmc.Monitor.

I will report back here with my findings.
Reply

Logout Mark Read Team Forum Stats Members Help
Skin/plugin interaction0