Kodi Community Forum

Full Version: convert plugin -> script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

When I tried to have my addon become a part of the kodi repo, I've been told that it should be a script and not a plugin. The add-on has workarounds to accomplish some things that shouldn't be in a plugin.

So, I reconfigured it as a script. installed and tested...

first problem; there is no argv[1] -- no pluginhandle for addDirectoryItem

after reading around in the forum, I find that argv does not exist for scripts. the script has to be called in some other way
e.g.: xbmc.executebuiltin("XBMC.RunScript(scriptpath,args)")

So now, I'm at a loss.

Is it possible / How do I get a "pluginhandle" to use for addDirectoryItem?

Without access to pluginhandle, I can't use addDirectoryItem to easily populate lists. I'd have to create the gui elements myself. (quite a daunting task)

Anybody know of a workaround?
did you every figure this out? I have a script and want to make a list of listitems I have made within the script I am just not sure how to get it to the skin.
It has been a very educational journey.

IMO, as a script alone, you can't get your listitem to the skin.

You have to make your own gui either by the python classes thinggy or your own skin (using xml).
It will never be as pretty as what the skinners can do.
Thanks I am actually a Skinner writing the script for the skin if that makes sense... So basically I need to just finish my items on the skin side and not worry with the plugin portion.
I don't have experience on calling a script from skin but i think it will be similar to running a script addon;

on the xml side, you can't have things that help make your ui consistent like includes and params.
if your script's xml uses back.png and the current skin has back.png, kodi will pick the one from the skin.

I usually start by creating the basic layout on the xml.
then on the python side, summon that xml via a class derived from xbmcgui.WindowXML and passing a list of listitems to it.
use getControl() with the control's ID to have python manipulate the controls in the xml,
add the listitem into the object assigned to the listcontainer.
you need to capture and define what happens when the user clicks on an item on the list if needed.
doModal will make the xml show up.

you also have to make the context menu if you want to have one.