Yak Shaving

just me

Archive for December, 2008

Banshee’s Database

without comments

I have been playing with Banshee the media player for Linux.

Its database is just a sqlite3 database. This makes getting data out very simple e.g.

:~$ sqlite3 ~/.config/banshee-1/banshee.db
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> select name from CoreArtists;
Cradle of Filth
ACDC
Alice in Chains
A Perfect Circle

I used -1 on my banshee path as I`m running the latest version not available from the standard repos for Ubuntu.

To talk to the database from python use the following:

:~$ python
Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect('.config/banshee-1/banshee.db')
>>> c = conn.cursor()
>>> c.execute("""select name from CoreArtists""")

>>> print c.fetchall()
[(u'Cradle of Filth',), (u'ACDC',), (u'Alice in Chains',), (u'A Perfect Circle',)]

Written by channam

December 28th, 2008 at 2:09 pm