PyDev Predefined Completions for XBMC modules

  Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
vikjon0 Offline
---
Posts: 2,500
Joined: Apr 2009
Reputation: 8
Location: Sweden
Post: #16
Seems to be working fine!

EDIT:
I see now that the script is available in the repositry and that the version number is higher there.. I must be slower than I thought because I am a bit confused. Never mind, it is working.
(This post was last modified: 2011-01-15 17:11 by vikjon0.)
find quote
HenrikDK Offline
Skilled Python Coder
Posts: 539
Joined: Jul 2007
Reputation: 18
Post: #17
This is a really nice addon, thanks for making the dev experience a bit better for us pydev people Smile
find quote
HenrikDK Offline
Skilled Python Coder
Posts: 539
Joined: Jul 2007
Reputation: 18
Post: #18
Hi, a new module has been added to the eden branch (xbmcvfs), could this be added to the plugin?, if needed i can provide a quick hack that fixes this issue.
find quote
jfcarroll Offline
Team-XBMC Developer
Posts: 456
Joined: Dec 2006
Reputation: 3
Location: Philadelphia area, US
Post: #19
Will get this over the weekend. It should be straightforward. I'll also need to update the version numbers for eden anyway.
find quote
jfcarroll Offline
Team-XBMC Developer
Posts: 456
Joined: Dec 2006
Reputation: 3
Location: Philadelphia area, US
Post: #20
The revision for xbmcvfs will be out there shortly (if it's not already). I did say "over the weekend" ... but I didn't say which one Smile

It should be backward compatible on Dharma.
find quote
Stagger Offline
Junior Member
Posts: 3
Joined: Nov 2011
Reputation: 0
Post: #21
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 want to write an addon python script. Here is what I did
1. downloaded python 2.5,2.7,3.2 exe
2. installed Aptana studio 3 which is based on eclipse
3. downloaded the users addon template project and opened it in aptana studio 3.

I read online that xbmc only supports 2.4x. Can you please tell me -
1. How I can add xbmc modules to the eclipse project
2. I know how to deploy addon from zip. But do I need to compile anything before deploying.
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?
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...

Thanks a bunch
find quote
HenrikDK Offline
Skilled Python Coder
Posts: 539
Joined: Jul 2007
Reputation: 18
Post: #22
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
(This post was last modified: 2011-11-24 23:33 by HenrikDK.)
find quote
takoi Offline
Team-Kodi Member
Posts: 838
Joined: Oct 2009
Reputation: 12
Location: Norway
Post: #23
Someone should push this addon to eden repo..
find quote
joshua.lyon Offline
Donor
Posts: 87
Joined: Dec 2009
Reputation: 1
Location: North Texas
Post: #24
jmarshall Wrote:You have access to the wiki - add away Smile

Done: http://wiki.xbmc.org/index.php?title=HOW...ptional.29

And thank you jfcarroll! This is a very nice and much needed improvement over the way I had been developing my plugin!
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #25
i just got around to installing eclipse with pydev and this. very nice coding environment and these predefines are very helpful considering so much has changed.

i thought i grabbed the latest, i case i did. you need a few minor changes for eden, i'm updating pydocs, the changes should be identical if you want a diff.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jfcarroll Offline
Team-XBMC Developer
Posts: 456
Joined: Dec 2006
Reputation: 3
Location: Philadelphia area, US
Post: #26
I was thinking of moving this to GitHub. If you want to make changes, let me know. I'll move it there since it'll be easier to work on it collaboratively.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #27
Jfcarrol, I combined your changes with the pydocs. Should this be made available in the main repo?

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jfcarroll Offline
Team-XBMC Developer
Posts: 456
Joined: Dec 2006
Reputation: 3
Location: Philadelphia area, US
Post: #28
Sorry for the late reply. I was out of town for a while. I'm not sure I understand what you mean.

In any case I'll move this to GitHub over the weekend and post the link here.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #29
pydocs now exports both html docs and predefines. theres a setting to select which ones to export both on by default.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
jfcarroll Offline
Team-XBMC Developer
Posts: 456
Joined: Dec 2006
Reputation: 3
Location: Philadelphia area, US
Post: #30
Oh. Then I think your version superceeds mine. Go ahead and put it out there. I'll edit the main post when you're ready.
find quote