getting started, want to contribute!

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
yitrc Offline
Junior Member
Posts: 8
Joined: Dec 2009
Reputation: 0
Post: #1
I have read all the tutorials on how to develop a xbmc plugin. I am a very experienced developer with years of programming experience. I would like to contribute to boxee, please give me some help so I can contribute. Is there a more active forum than this one? I see very little activity here...

Ok, so in all the plugin examples I have seen so far, they require some dependecies:

import xbmcplugin
import xbmcgui
import xbmc

Where can I get these files so I can start running some of the plugins mentioned in the tutorials??
find quote
VictorV Offline
Senior Member
Posts: 124
Joined: May 2009
Reputation: 1
Location: Norway
Post: #2
Those are builtin modules. Since they are dependent on a running instance of xbmc, you need to be running the script/plugin from within xbmc.
If you want to run from commandline you need to create dummies, or not import them when debugging from command line.
find quote
yitrc Offline
Junior Member
Posts: 8
Joined: Dec 2009
Reputation: 0
Post: #3
ok, so can you please tell me the steps to test my plugins?

1) change the python code
2) run xbmc
3) where is debugging code output to? Can it only be sent to a log file? what log file?

Thanks for helping me get started!
find quote
Temhil Offline
Skilled Python Coder
Posts: 397
Joined: Apr 2008
Reputation: 1
Location: Canada
Post: #4
You need to put your .py file in the right directory for example if you develop a video plugin you need to put that in /plugin/video (depending on the type of XBMC you have chosen and your platform, it will be either in you XBMC directory either your profile directory).
For debug, you have an option in XBMC in order to activate debug, but mostly what will need is to open the xbmc.log file usaully a the root level of you XBMC install (or profile).

Unfortunately you don't have an easy way to test you scripts/plugins in an IDE, you need to run it in XBMC if you import one of the built in modules.

[Image: passionxbmc_signature.png]
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

[Image: project_thin_badge.gif]
find quote
Clumsy Offline
Team-XBMC Forum Moderator
Posts: 641
Joined: Feb 2004
Reputation: 0
Post: #5
What I did when hacking around on plugins, was to enable debug logging in xbmc, then minimize xbmc, open a logviewer that can tail a logfile, there are several around for every system you want, on linux a console with "tail -f xbmc.log" works fine. Then hack away and test my plugin on the fly by switching back to xbmc Smile

I found it helpful to make my basic functionality (the scraping and regular expressions to get the urls) in an ide outside of xbmc first. Well, not even an ide, on of those command line python interpretes worked fine for me, to realtime dabble around. When I had what I wanted, I integrated that step by step into a plugin. The last part is pretty easy, once you understand how the concept of a plugin works (i.e. that it kind of calls itself again on menu level changes if I recall that correct, has been over a year).

Btw: what kind of content are you looking at ? I personally don't car emuch for all those film/series streaming sites that randomly work for 2 weeks and then go down again, I am more of a fan of pages like ted.com (already a great plugin for that, but maybe there are similar sites) or other sites with free content that stay online for years. Have fun coding Smile

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.
(This post was last modified: 2009-12-29 13:09 by Clumsy.)
find quote
bazza2000 Offline
Junior Member
Posts: 12
Joined: Aug 2009
Reputation: 0
Location: Liverpool, England
Post: #6
Clumsy Wrote:What I did when hacking around on plugins, was to enable debug logging in xbmc, then minimize xbmc, open a logviewer that can tail a logfile, there are several around for every system you want, on linux a console with "tail -f xbmc.log" works fine. Then hack away and test my plugin on the fly by switching back to xbmc Smile

I found it helpful to make my basic functionality (the scraping and regular expressions to get the urls) in an ide outside of xbmc first. Well, not even an ide, on of those command line python interpretes worked fine for me, to realtime dabble around. When I had what I wanted, I integrated that step by step into a plugin. The last part is pretty easy, once you understand how the concept of a plugin works (i.e. that it kind of calls itself again on menu level changes if I recall that correct, has been over a year).

Btw: what kind of content are you looking at ? I personally don't car emuch for all those film/series streaming sites that randomly work for 2 weeks and then go down again, I am more of a fan of pages like ted.com (already a great plugin for that, but maybe there are similar sites) or other sites with free content that stay online for years. Have fun coding Smile

Hi, I've been having a play with plugins over the past few days and your mention of an 'ide' outside of xbmc for development has got me thinking about a potential better solution for these types of plugins where the main functionality of the plug rarely changes, only the 'scraping and regular expressions' stuff changes when the target websites fancy a design change etc.

The alternate solution is to host the 'scraping and regular expressions' in a separate function which is downloaded at plugin start time and imported into the runtime. Therefore, plugins could dynamically pick up the latest version of the function which would remove the need for all users to "SVN Repo" re-install the latest version of the plugin. It would also reduce the developers time in regening and uploading a new version of the plugin and as the function would potentially under the wiki version control anyone with RE skills could modify.
Obviously, the function download locations (e.g. xbmc.org/wiki/plugins/<plugin name>_<ver>.def) would need to be defined and configured, but this might make for a better model. I've not had much exposure to plugins and previous discussions so comments are welcome on whether this has already been discounted or alternative ways forward are already in the pipeline.

I used a local webserver to test the function download, import and use and it appears to work pretty well.

My sample code is shown below:
Code:
import urllib2,urllib,re

# URL from local webserver, although this would eventually be the XBMC.org wiki or similar website.
url='http://admin90:8080/python.html'

#WebPage Content is as follows (obviously without the #'s):
#<HTML><BODY><H1>
#def one():
#        global temp
#        temp=9876
#        print "Temp: ", temp
#</H1></BODY></HTML>

#Get Webpage
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()

#Get Start Point of 'def one' function
p = re.compile('<HTML><BODY><H1>')
m=p.match(link)
m.group()
start = m.end()

# Get End Point of 'def one' function
q = re.compile('</H1></BODY></HTML>')
n=q.search(link)
n.group()
end = n.start()

# Write contents (i.e. def one function) to local file
filename = "dyn.py"
FILE = open(filename,"w")
FILE.writelines(link[start+1:end-1])
FILE.close()

# Import file
import dyn

# Run downloaded functionality.
dyn.one()
print "dyn.test = ", dyn.temp

Output:
Code:
>>>
Temp:  9876
dyn.test =  9876
>>>

Apologies for potentially hijacking this thread, but thought the comments in the thread were relevant to the discussion.
find quote
rwparris2 Offline
Team-XBMC Python Developer
Posts: 1,333
Joined: Jan 2008
Reputation: 2
Location: US
Post: #7
Quote:I found it helpful to make my basic functionality (the scraping and regular expressions to get the urls) in an ide outside of xbmc first. When I had what I wanted, I integrated that step by step into a plugin.

Yes, do it like that. Write a scraper or api-access class separate from anything xbmc does. Keep it in a separate file. Once you have your that working in command line, write the plugin method's or your script's ui and just make calls to your scraper class.

Quote:The alternate solution is to host the 'scraping and regular expressions' in a separate function which is downloaded at plugin start time and imported into the runtime.

The biggest problem with that solution (as it is written) is it introduces extra points of failure: e.g. the server that hosts the file could be down which wouldn't necessarily have anything to do with the site it is trying to scrape, write permissions of the plugin folder could be wrong, etc.

Plus it has the fundamental flaw of being an auto-updating system where the updates aren't persistent and only apply to one type of bug... why not just update the whole thing?

Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
find quote
bazza2000 Offline
Junior Member
Posts: 12
Joined: Aug 2009
Reputation: 0
Location: Liverpool, England
Post: #8
rwparris2 Wrote:Yes, do it like that. Write a scraper or api-access class separate from anything xbmc does. Keep it in a separate file. Once you have your that working in command line, write the plugin method's or your script's ui and just make calls to your scraper class.



The biggest problem with that solution (as it is written) is it introduces extra points of failure: e.g. the server that hosts the file could be down which wouldn't necessarily have anything to do with the site it is trying to scrape, write permissions of the plugin folder could be wrong, etc.

Plus it has the fundamental flaw of being an auto-updating system where the updates aren't persistent and only apply to one type of bug... why not just update the whole thing?

Thanks for the feedback, most welcome. I still believe it has its benefits, in terms of the flaws you mention, the auto-update could check to see if the website is up, if not, it just uses the current "cached" copy. In terms of permissions on the plugin folder, this could be checked and either raise an exception/log entry and then use the default one which could be provided with the script.

I suppose it breaks down to how often sites change and how often developers of plugins actually use them themselves and therefore see that a fix is required. The other thing to consider is how easy is it for someone with minimal programming knowledge to update the regular expressions etc.
find quote