Accessing a MySQL database
#1
Hi all,
I'm new here, and new to XBMC.

I'm running XBMC on my Ubuntu laptop. (I'm experimenting with moving from Windows to Ubuntu)

On my Windows system, I use Movie Collectorz to store all my movie info. There is a way to export the Collectorz database to a MySQL database.

What I'd like to do is to write a script for XBMC to display a list of the movies in the MySQL database, and play that movie.

I found a nice tutorial that has a simple Python script working with XBMC. However, when I add the 'include MySQLdb' line to the python script, it fails with 'No module named MySQLdb'

I've installed the Python MySQL module in Ubuntu, and it works from a commandline python script.

How can I get XBMC to recognize that I have the module, or is there a seperate module for XBMC?

Thanks!
Brian
Reply
#2
you need to supply the module in the same folder as your script.
Reply
#3
Thanks, that got me closer.

I had to copy the MySQLdb directory, and _mysql.so. Now when I run the script, xbmc closes with no errors.

Heres whats in xbmc.log:
Code:
17:59:58 T:878417984 M:1269411840   DEBUG: Load list-focus.png: 0.2ms (bundled)
17:59:58 T:468646224 M:1269411840  NOTICE: -->Python Interpreter Initialized<--
17:59:58 T:468646224 M:1269411840  NOTICE:
17:59:58 T:468646224 M:1269411840   DEBUG: Process - The source file to load is special://home/scripts/My Scripts/movie.py
17:59:58 T:468646224 M:1269411840   DEBUG: Process - Setting the Python path to /home/brian/.xbmc/scripts/My Scripts;/usr/share/xbmc/system/python/python24.zip;/usr/share/xbmc/system/python/lib/python24.zip;/usr/share/xbmc/system/python/lib/python2.4/;/usr/share/xbmc/system/python/lib/python2.4/plat-linux2;/usr/share/xbmc/system/python/lib/python2.4/lib-tk;/usr/share/xbmc/system/python/lib/python2.4/lib-dynload
17:59:58 T:468646224 M:1269411840   DEBUG: Process - Entering source directory /home/brian/.xbmc/scripts/My Scripts
17:59:58 T:468646224 M:1269411840   DEBUG: xbp_dlopen loading python lib /home/brian/.xbmc/scripts/My Scripts/_mysql.so. flags: 2
17:59:58 T:468646224 M:1269411840   DEBUG: Loading: /home/brian/.xbmc/scripts/My Scripts/_mysql.so
17:59:58 T:468646224 M:1269276672   DEBUG: RegisterExtensionLib, adding _mysql.so (0x25ac930)
17:59:58 T:468646224 M:1269276672   DEBUG: xbp_dlsym - load symbol init_mysql
Reply
#4
I found the problem. The _mysql.so version for 64bit Jaunty does not work properly with XBMC.
I got the _mysql.so from Intrepid (for python 2.4) and that works fine with XBMC.

If anyone else runs into this, heres where to get the proper _mysql.so

http://packages.ubuntu.com/intrepid/python-mysqldb

Thanks for the help, and I'll probably be back with more questions!

Brian
Reply

Logout Mark Read Team Forum Stats Members Help
Accessing a MySQL database0