Plugin python directory services for XBMC (now in SVN)

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jmarshall Offline
Team-XBMC Developer
Posts: 26,228
Joined: Oct 2003
Reputation: 177
Rainbow  Plugin python directory services for XBMC (now in SVN)
Post: #1
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/Ap...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

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Gamester17 Offline
Team-XBMC Forum Moderator
Posts: 10,523
Joined: Sep 2003
Reputation: 10
Location: Sweden
Question   
Post: #2
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.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #3
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

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Gamester17 Offline
Team-XBMC Forum Moderator
Posts: 10,523
Joined: Sep 2003
Reputation: 10
Location: Sweden
Post: #4
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

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #5
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.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #6
nuka, sure it can.

you want me to add it or you want to be educated?Smile
find quote
Asteron Offline
"Skilled" Python Coder
Posts: 928
Joined: Feb 2004
Reputation: 0
Post: #7
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.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #8
http://xbmc-scripting.googlecode.com/svn...Plugin.zip

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

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
pike Offline
Project Manager
Posts: 4,832
Joined: Sep 2003
Reputation: 29
Location: Sweden
Post: #9
wouldnt a better location for plugins be system/plugins ? it would also emphasize the difference better ?

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #10
where were you people before the merge into trunk Smile

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #11
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

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
(This post was last modified: 2007-08-21 07:02 by Nuka1195.)
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #12
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.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #13
Diff for: fix for setInfo() infolabel's not accepting unicode.

deleted code already committed

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
(This post was last modified: 2007-08-21 22:07 by Nuka1195.)
find quote
matthuisman Offline
Skilled Python Coder
Posts: 600
Joined: Sep 2006
Reputation: 5
Location: Chch, New Zealand
Post: #14
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
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,228
Joined: Oct 2003
Reputation: 177
Post: #15
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?

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
(This post was last modified: 2007-08-22 02:46 by jmarshall.)
find quote
Post Reply