Kodi Community Forum
Plugin python directory services for XBMC (now in SVN) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Plugin python directory services for XBMC (now in SVN) (/showthread.php?tid=28031)

Pages: 1 2 3 4 5 6


Plugin python directory services for XBMC (now in SVN) - jmarshall - 2007-08-20

Hi All,

Thanks to the hard work of Umbehagen and Nuka1195 and myself, we now have plugin python directories available within the XBMC GUI as additional "Sources".

This allows your media-type scripts to incorporate in a more seamless way with XBMC's views - no need to develop a script that needs to be skinned to look seamless Smile

First off, you need latest SVN - revision 10008 or newer.

Then you need some plugins, or to write your own. Nuka1195 has kindly made a preliminary version of the Apple Movie Trailers plugin available - you can grab it here:

http://www.xboxmediacenter.com/upload/Apple Movie Trailers Plugin.rar

He's also updated the python docs including the new plugin module which (currently) contains 3 functions here:

http://www.xboxmediacenter.com/upload/Python Docs.rar

You throw these plugins in Q:\plugins\<type of media>\ in the usual directory structure for scripts (i.e. <scriptname>\default.py). Once a user has (say) a video plugin, the "Video Plugins" source will be available via the Add Source dialog - they can ofcourse browse down from there and add a particular plugin (or a subfolder of a plugin).

The interface is pretty simple:

You have a script that takes in some arguments. The first is the base path of the URL that is being browsed by the user. The second is a handle to the directory class that is requesting the directory, and the last is the URL options that are either blank, or are something that you have filled in on a previous directory fetch.

You then generate some listitems based on these arguments and send them to XBMC via the addDirectoryItem() function.

Once you are done, you can (optionally) add some sortmethods (via addSortMethod), and lastly call endDirectory() with a boolean parameter of success or failure.

XBMC then formats your items up and displays them in the list, just like any other folder (local, smb, replaytv, musiclibrary etc.).

For reference, the development thread is here:

http://forum.xbmc.org/showthread.php?tid=27760

That's all for now. There's still more things we have planned for this, and we'll continue discussion of that in this thread.

Cheers,
Jonathan


- Gamester17 - 2007-08-20

So are there now two directories where scripts are kept ("\XBMC\Scripts\" and "\XBMC\Plugins\")?
...if so then sorry but that does not sound very user-fiendly, it will be confusing for many users.


- Nuka1195 - 2007-08-20

Ideally there could be an installer. I think xbmcscripts.com will support it.

For scripts like AMT, I don't know if it will ever be fully transfered to plugin. So you'll need the main script, which I will add an install plugin option or just do it automatically.

It really is a nice feature, You get:
1. multiple items queued
2. play videos in 1080i, no script memory overhead
3. no need to skin
4. a cool new name plugin Smile

probably others


- Gamester17 - 2007-08-20

If each and every script that uses the plugins folder option automaticly copies and runs itself from there (so it's unvisible/unnoticible to the end-user) then it will work. The point being that the end-user should only have to care about one folder if installing scripts manually. Maybe put togther a module for python scripts that takes care of this, and one or two reference scripts that shows how to use it for different types of scripts?

...some sort of automatic clean-up service is probably needed as well so that if the end-user manually delete a script from the "\XBMC\Scripts\" folder then XBMC automaticly checked and deletes the respective script folder under "\XBMC\Plugins\".

Remember, it must be simple for the end-user Wink


- Nuka1195 - 2007-08-20

Could m_strStudio be added to the database? I could use a studio sort method and format parameter?

IMDB has company which looks to be studio.


- spiff - 2007-08-20

nuka, sure it can.

you want me to add it or you want to be educated?Smile


- Asteron - 2007-08-21

Gamester17 Wrote:So are there now two directories where scripts are kept ("\XBMC\Scripts\" and "\XBMC\Plugins\")?
...if so then sorry but that does not sound very user-fiendly, it will be confusing for many users.

I think the separate folder is warranted. A plugin is more closely tied into XBMC as it is only used to populate a folder listing from within Videos or Music or whatever. A plugin does not have its own gui and should not be invoked by the user. Putting it in its own folder also allows XBMC to easily recognize it.

A normal script (typically) has its own interface and is invoked by the user, can be added to favorites, needs to be skinned, etc. That doesnt apply to a plugin.

When we discussed this earlier we hoped that by calling them 'plugins' as opposed to 'scripts' would help users distinguish between the two.

I admit there is a possible overlap if a script supports both interfaces and decides on its own how to behave depending on the arguments passed to it. I dont know how much of that we will see.

In any case I imagine installing eventually all being handled by blittan's XBMC Script Installer with a new category.


- Nuka1195 - 2007-08-21

http://xbmc-scripting.googlecode.com/svn/old/TVLinksPlugin.zip

heres a patched TV Links, some of the items aren't formatted correctly, but it should work


- pike - 2007-08-21

wouldnt a better location for plugins be system/plugins ? it would also emphasize the difference better ?


- Nuka1195 - 2007-08-21

where were you people before the merge into trunk Smile


- Nuka1195 - 2007-08-21

I used the wrong call to convert the python object to set text infolabels. That's why plot was failing.

Code:
argh it's late i'll post the diff in the morning



- Nuka1195 - 2007-08-21

Can the label that says Videos, be an infolabel for the current source your in.

Could a plugin get a way to signify movies or tv shows? if so that would be helpful.


- Nuka1195 - 2007-08-21

Diff for: fix for setInfo() infolabel's not accepting unicode.

deleted code already committed


- matthuisman - 2007-08-22

Any plans for getting this in the MyPrograms menu?

I say this, as I was thinking about porting eg, RetroX over to use this.
Imagine all your roms being listed etc in XBMC, no script needed.

This is what gave me the idea : http://forums.xbox-scene.com/index.php?showtopic=617466

Oh, and is it python or XBMC that controls what happens when a list item is selected?

Thanks,
Stanley87


- jmarshall - 2007-08-22

XBMC controls what happens when the list item is selected. If it's a folder it opens, otherwise it plays the file.

And it's not currently enabled in My Programs, but I see no reason not to have it there if you want it there.

For ROM browsing type things, I guess what you effectively need to do is set some params in the CFileItem so that we know what ROM to start it with (and any other params to start).

Perhaps we can do this via options in the path URL?