PDA

View Full Version : Getting Started with boxee API, for those new to XBMC + Python!



robcoles
April 9th, 2009, 11:41 PM
OK so maybe I was a little ambitous when I sat down at my PC after a few beers tonight and decided I'd have a play at using the boxee API to see how it worked.. but here is where I've got to so far.

On MAC OSX, the simpliest way to add a plugin locally is to use the global path, as then you don't need to edit the sources.xml file somwhere, e.g. my music plugin is in a directory at

/Applications/Boxee.app/Contents/Resources/Boxee/plugins/music/TEST

Create a 128x128 png file and put in TEST/default.tbn
Create a TEST/Default.py file for your python code
Create a TEST/descriptor.xml as per http://developer.boxee.tv/app-descriptor/

To get started with that.. I went here:
http://members.cox.net/alexpoet/downloads/Tutorial/Python-XBMC.pdf

Which allowed me to get hello world on screen, although for some reason with the "loading" spinner on top of it..

I went back to the boxee API, to try to understand how that built on the XBMC API, and I was able to "import mc" the python API listed on the boxee page and start replacing the print "DEBUG" with mc.LogDebug("DEBUG") or mc.LogInfo("DEBUG").

The debug output goes to
~/Library/Logs/boxee.log

After getting through this, which does work, it was dawning on me that I think I was approaching this backwards, the "standard" way to develop boxee plugins appears to be to use the WindowXML format with embedded python against the specific onscreen controls, rather than python that embeds the creation of controls.. hopefully playing with this will make something that looks better and more consistent with the rest of boxee!

Also contrary to my first assumption that the descriptor type "skin" is not just about overriding look and feel, but appears possibly synonymous with application.

Anyone got any help tips for someone wanting to get started with this?

robcoles
April 11th, 2009, 03:54 PM
OK.. so a bit more progress:

Not sure if this is helpful or not.. but if you want to turn up the loglevel
a bit ( and get Debug messages) aswell as onscreen FPS/version, then
create ( if it does not exist )

~/Library/Application\ Support/BOXEE/UserData/advancedsettings.xml

The following content brings it to debug level

<advancedsettings>
<loglevel>0</loglevel>
</advancedsettings>

See xbmc util/log.h for details on what number for which level, but 0 is the most verbose.

So my Default.py now looks like this

import xbmc, xbmcgui,mc,os

class MyClass(xbmcgui.WindowXML):

def onInit(self):
# Display items here
self.strAction = xbmcgui.ControlLabel(300, 200, 200, 200, "", "font14", "0xFF00FF00")
self.addControl(self.strAction)
self.strAction.setLabel("Hello world")

mydisplay = MyClass("main.xml",os.getcwd(),"Default",False)
mc.LogInfo("Music Done" )
mydisplay.doModal()
del mydisplay

In have an xml file in [plugin]/resources/skins/Boxee\ Skin\ NG/720p/main.xml

My page now loads and I see a DEBUG message in the log timing how long it took to load.

For some reason the "busy" spinning dialog still shows on screen, suspect there is something I have to call to hide/stop it.. but not sure what!

robcoles
April 11th, 2009, 09:50 PM
But unfortunately locks up the system subsequently! - think I'm still going about this, somewhat the wrong way.

matt.antone
May 5th, 2009, 06:58 PM
You can use show instead of doModal.

window.show()

I'm attacking a plugin the same way and am running into problems myself. Maybe you're way ahead of me at this point, but have you gotten the onInit() to work?