Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Saturday, March 20, 2010

XBMC Python tips – how to get build version & date

Python code:

import xbmc
result = xbmc.executehttpapi('GetSystemInfo(120;121)')
system_info    = result.split('<li>')
print "Version = " + system_info[1]
print "Date    = " + system_info[2]

or

import xbmc
result = xbmc.executehttpapi('GetSystemInfoByName(system.buildversion;system.builddate)')
system_info    = result.split('<li>')
print "Version = " + system_info[1]
print "Date    = " + system_info[2]

or even a simpler alternative, suggested by BigBellyBilly:

import xbmc
version = xbmc.getInfoLabel('System.BuildVersion')
date    = xbmc.getInfoLabel('System.BuildDate')
print "Version = " + version
print "Date    = " + date

Result :

Version = 9.11 r26017 
Date    = Dec 23 2009

References:

Saturday, March 14, 2009

Pydev - Eclipse plugin for Python development


What is Pydev?

Pydev is a plugin that enables users to use Eclipse for Python and Jython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others. If you want more details on the provided features, you can check here.

Pydev and Pydev Extensions are now products of Aptana, makers of the popular Aptana Studio, Eclipse-based IDE for Ajax, Jaxer, Ruby on Rails, and PHP. You can plug Pydev into Aptana Studio or both into Eclipse and use them side by side. Aptana plans deeper integrations in the future.

* * *
 
As I was writing the post on Notepad++ the other day it just stroke me - there must be a plugin that allows all the Eclipse goodness for Python coding. A nice editor with highlighting, auto-completion, navigation to methods / variables would be very hand especially to Python newbies like myself. Having all the tools at hand, the project explorer, the editor windows, the team / SVN synchronisation, hey I should've thought about that while ago - I guess I was doing alright with Notepad++ and RapidSVN, but now this should be even better.

The installation was quite a breeze, the Pydev Getting Started section is very helpful with plenty of details and screenshots. They also have a couple of video tutorials, that should help getting started, especially if you are not the usual Eclipse user.

I managed to install the plugin in both Eclipse 3.4.1 and 3.5 M5, the other thing I had to do was to get the Subversive plugin and connectors from Polarion. My Eclipse 3.4.1 was installed from the Eclipse IDE for Java EE Developers 3.4.1 bundle (hmmm, I see there is 3.4.2 bundle out now...) so I didn't have to install anything to get the XML editing; for Eclipse 3.5 M5 I installed the Web Tools Platform 3.1 integration – that is probably a bit too much if you are only going to use it for Python, but it doesn't hurt if you use the same Eclipse for Java as well.

Here are some screenshots: