Stagger Wrote:Folks - I am new to XBMC python programming (actually new to Python). I have other programming experience and am familiar with eclipse but new to Python. So I am struggling a bit...
....
I read online that xbmc only supports 2.4x. Can you please tell me -
XBMC's stable release currently only supports 2.4 but, the nightly builds have been upgraded to 2.6, in order to use the 2.6 version you need to be running a nightly release of xbmc (found
here) and add the folowing to your addon.xml:
Code:
<import addon="xbmc.python" version="2.0"/>
Quote:1. How I can add xbmc modules to the eclipse project.
Well you can't really add any modules that will allow you to debug the code in eclipse. If you want to achieve this you need to attach to the running process in XBMC (
http://wiki.xbmc.org/index.php?title=HOW...th_Eclipse), but in my experience this is very unstable and often causes xbmc to crash, i found it easier to just run the plugin inside xbmc and write to the log to find out if there were any errors. What you can do though is add these predefine compilations to aptana and that way get code completion and highlighting inside your development environment. This is done by first using this plugin to generate the files then
1. Go into aptana, Project Properties -> interpreter -> configure interpreter
2. Selecting the "predefined" tab and adding the folder location of your predefined compilations to the interpreter.
Quote:2. I know how to deploy addon from zip. But do I need to compile anything before deploying.
When you're distributing the plugin you only need the .py files (no compiled output necessary), xml files, and any images you have. But getting the zip file right can be quite tricky and xbmc isn't very good at telling you whats wrong with your particular file. I would suggest creating a "build" script to manage this process for you, otherwise its gonna be a pain.
Quote:3. The testing part is what is puzzling me - is there a quick way to test this plugin - do I have to deploy this addon everytime to test it?
With the youtube plugin what we did for a long time was simply developing our plugin in the folder where xbmc expects to find it. On windows that means placing your code in:
Code:
C:\Users\<current running user>\AppData\Roaming\XBMC\addons\plugin.video.someplugin
And getting aptana to point to this location.
On linux or mac you could simply create a symlink to the folder where your plugin code resides, an thus not need to mess with aptana settings. While neither of these are very pretty solutions. they are very effective, this way you're able to have xbmc running while your coding and quickly get feedback on your code changes.
Alternatively we've recently switched to a more test driven approach and are now running automated unit-tests and integration test on our code. This means that we can usually test any specific feature from a simple terminal. If you're interested in any of this work it can be found
here,
here and
here. It should be said that there's
a lot of work in getting such a setup up and running, particularly in getting the "xbmc" dependency mocked out, and applying Inversion of Control.
4. Also I was planning to write addon to scrape webpage in a website which has picture gallery and video trailers. How difficult is this? BeautifulSoup is that what I should use for parsing the pages...
BeautifulSoup is fine for what you need, in order to get quickly started i would suggest just making a simple python script that generates a lost of dictionaries with each dictionary representing a list item in xbmc, this way it should be fairly simple to reuse the code in the final plugin. If you're looking for inspiration on this front you could take a look at our scraper in the release branch as this still uses soup.
Code:
http://code.google.com/p/youtubexbmc/source/browse/#svn%2Fbranches%2Frelease
Hope this helps
/HenrikDK