<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yak Shaving &#187; Google</title>
	<atom:link href="http://www.chrishannam.co.uk/category/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrishannam.co.uk</link>
	<description>just me</description>
	<lastBuildDate>Wed, 14 Dec 2011 12:13:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>App Engine Templating</title>
		<link>http://www.chrishannam.co.uk/2011/02/app-engine-templating/</link>
		<comments>http://www.chrishannam.co.uk/2011/02/app-engine-templating/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 12:59:02 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=347</guid>
		<description><![CDATA[Recently I was trying to iterate over a dictionary in a template, this did not end well. By default App Engine is using the Django 0.96 templating engine. Attempting to use {% for key, value in dict.items %} gave the cryptic error &#8216;for&#8217; statements with five words should end in &#8216;reversed&#8217; a bit of googling [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was trying to iterate over a dictionary in a template, this did not end well. By default App Engine is using the Django 0.96 templating engine. Attempting to use</p>
<pre class="brush: python; ruler: true;">
{% for key, value in dict.items %}
</pre>
<p>gave the cryptic error <strong>&#8216;for&#8217; statements with five words should end in &#8216;reversed&#8217;</strong> a bit of googling revealed this was due to using Django 0.96.</p>
<p>Later versions of App Engine now support Django templating using 1.2 as well as 0.96. You can use 1.0 and 1.1 but you will to install them yourself. More info at <a href="http://code.google.com/appengine/docs/python/tools/libraries.html#Django">http://code.google.com/appengine/docs/python/tools/libraries.html#Django</a>. When using the imports make sure the library part goes before your other imports:</p>
<pre class="brush: python; ruler: true;">
from google.appengine.dist import use_library
use_library('django', '1.2')

from lastfm.helpers import get_events_for_artist, get_events_for_user
from google.appengine.api import users
from google.appengine.ext import webapp
</pre>
<p>Otherwise you see: <strong>django 1.2 was requested, but 0.96.4.None is already in use</strong> errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2011/02/app-engine-templating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebDriver for logging into Twitter</title>
		<link>http://www.chrishannam.co.uk/2009/06/webdriver-for-logging-into-twitter/</link>
		<comments>http://www.chrishannam.co.uk/2009/06/webdriver-for-logging-into-twitter/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 13:05:15 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[webdriver]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=224</guid>
		<description><![CDATA[No real reason for choosing Twitter apart from its cool . The code below uses unittest to run. It creates a new WebDriver object and users it to fetch http://twitter.com and submit a username and password. Once the details are added it &#8220;clicks&#8221; the &#8220;Sign In&#8221; button to login into Twitter. #!/usr/bin/env python import unittest [...]]]></description>
			<content:encoded><![CDATA[<p>No real reason for choosing Twitter apart from its cool <img src='http://www.chrishannam.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
<p>The code below uses unittest to run. It creates a new WebDriver object and users it to fetch http://twitter.com and submit a username and password. Once the details are added it &#8220;clicks&#8221; the &#8220;Sign In&#8221; button to login into Twitter.</p>
<pre name="code" class="python">
#!/usr/bin/env python

import unittest
import logging
from webdriver_firefox.webdriver import FirefoxLauncher
from webdriver_firefox.webdriver import WebDriver

class TwitterTests (unittest.TestCase):

    def test_login_twitter(self):
        driver = WebDriver()
        driver.get("http://twitter.com")

        # find our elements - the html on the page with same ids
        username_element = driver.find_element_by_id('username')
        password_element = driver.find_element_by_id('password')

        # use this to toggle the remember me box
        remember_me_element = driver.find_element_by_id('remember')

        # type into the boxes
        username_element.send_keys('yourusername')
        password_element.send_keys('yourpassword')
        remember_me_element.toggle()

        # click Sign In and we should be logged in
        driver.find_element_by_id('signin_submit').click()

       # check that the title of the page is correct to see if we logged in
        self.assertEqual(driver.get_title(), 'Twitter / Home')

        # Extract from the html using xpath to find username and updates of the people on the screen
        updates = driver.find_elements_by_xpath("//span[@class='entry-content']");
        user = driver.find_elements_by_xpath("//a[@class='screen-name']");

        # display in the terminal the name and the update
        for i,update in enumerate(updates):
            print user[i].get_text() + ": " +update.get_text()

        # uncomment the following to close the window and finish
        #driver.quit()

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)
    unittest.main()
</pre>
<p>The docs are not great for WebDriver but reading the source is pretty simple. Being able to mentally parse Java to Python is also a big advantage!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/06/webdriver-for-logging-into-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Odd Google App Engine Issue</title>
		<link>http://www.chrishannam.co.uk/2009/05/odd-google-app-engine-issue/</link>
		<comments>http://www.chrishannam.co.uk/2009/05/odd-google-app-engine-issue/#comments</comments>
		<pubDate>Sat, 30 May 2009 20:44:30 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[gae]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=217</guid>
		<description><![CDATA[I was having issues getting a url with urlfetch.fetch(url), it kept failing with: [snip] File "/home/channam/Code/python/google_appengine/google/appengine/api/urlfetch.py", line 241, in fetch return rpc.get_result(allow_truncated) File "/home/channam/Code/python/google_appengine/google/appengine/api/urlfetch.py", line 388, in get_result self.check_success(allow_truncated) File "/home/channam/Code/python/google_appengine/google/appengine/api/urlfetch.py", line 356, in check_success raise DownloadError(str(e)) DownloadError: ApplicationError: 2 A little bit of poking found that the issue was caused by having a space [...]]]></description>
			<content:encoded><![CDATA[<p>I was having issues getting a url with urlfetch.fetch(url), it kept failing with:</p>
<pre class="brush: python; ruler: true;">
[snip]
  File "/home/channam/Code/python/google_appengine/google/appengine/api/urlfetch.py", line 241, in fetch
    return rpc.get_result(allow_truncated)
  File "/home/channam/Code/python/google_appengine/google/appengine/api/urlfetch.py", line 388, in get_result
    self.check_success(allow_truncated)
  File "/home/channam/Code/python/google_appengine/google/appengine/api/urlfetch.py", line 356, in check_success
    raise DownloadError(str(e))
DownloadError: ApplicationError: 2
</pre>
<p>A little bit of poking found that the issue was caused by having a space in the url, something which I&#8217;m fairly certain was ok on early versions of GAE. Oh well you live and learn.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/05/odd-google-app-engine-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bit.ly for the win</title>
		<link>http://www.chrishannam.co.uk/2009/03/bitly-for-the-win/</link>
		<comments>http://www.chrishannam.co.uk/2009/03/bitly-for-the-win/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 11:35:47 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[bit.ly]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=194</guid>
		<description><![CDATA[I got my Google App Engine library featured on the list of entries for bit.ly&#8217;s competition see bit.ly competition. Admittedly its a small bit of code but I hope someone might find a use for it. But I`m still waiting for swag]]></description>
			<content:encoded><![CDATA[<p>I got my Google App Engine library featured on the list of entries for bit.ly&#8217;s competition see <a href="http://blog.bit.ly/post/76203780/bit-ly-api-contest-winners">bit.ly competition</a>. Admittedly its a small bit of code but I hope someone might find a use for it.</p>
<p>But I`m still waiting for swag <img src='http://www.chrishannam.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/03/bitly-for-the-win/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forms in App Engine</title>
		<link>http://www.chrishannam.co.uk/2009/03/forms-in-app-engine/</link>
		<comments>http://www.chrishannam.co.uk/2009/03/forms-in-app-engine/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 10:45:43 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=189</guid>
		<description><![CDATA[A handy hint from an on the ball App Engine fella: how to extend the StringProperty class so that it will render as a password field]]></description>
			<content:encoded><![CDATA[<p>A handy hint from an on the ball App Engine fella: <a href="http://hatcattery.appspot.com/article?id=1">how to extend the StringProperty class so that it will render as a password field</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/03/forms-in-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>App Engine and utf-8 Encoding</title>
		<link>http://www.chrishannam.co.uk/2009/02/app-engine-and-utf-8-ecoding/</link>
		<comments>http://www.chrishannam.co.uk/2009/02/app-engine-and-utf-8-ecoding/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 18:17:25 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=119</guid>
		<description><![CDATA[You may or may not have seen the error: &#60;type &#8216;exceptions.UnicodeDecodeError&#8217;&#62;: &#8216;ascii&#8217; codec can&#8217;t decode byte 0xc3 in position 2223: ordinal not in range(128) args = (&#8216;ascii&#8217;, &#8216;&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Tra&#8230; Engine&#8221; /&#62;\n\t\t&#60;/div&#62;\n\n\t&#60;/div&#62;\n\n&#60;/body&#62;\n\n&#60;/html&#62;\n\n&#8217;, 2223, 2224, &#8216;ordinal not in range(128)&#8217;) encoding = &#8216;ascii&#8217; end = 2224 message = &#8221; object = &#8216;&#60;!DOCTYPE html [...]]]></description>
			<content:encoded><![CDATA[<p>You may or may not have seen the error:</p>
<p>&lt;type &#8216;exceptions.UnicodeDecodeError&#8217;&gt;: &#8216;ascii&#8217; codec can&#8217;t decode byte 0xc3 in position 2223: ordinal not in range(128)<br />
args = (&#8216;ascii&#8217;, &#8216;&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Tra&#8230; Engine&#8221; /&gt;\n\t\t&lt;/div&gt;\n\n\t&lt;/div&gt;\n\n&lt;/body&gt;\n\n&lt;/html&gt;\n\n&#8217;, 2223, 2224, &#8216;ordinal not in range(128)&#8217;)<br />
encoding = &#8216;ascii&#8217;<br />
end = 2224<br />
message = &#8221;<br />
object = &#8216;&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Tra&#8230; Engine&#8221; /&gt;\n\t\t&lt;/div&gt;\n\n\t&lt;/div&gt;\n\n&lt;/body&gt;\n\n&lt;/html&gt;\n\n&#8217;<br />
reason = &#8216;ordinal not in range(128)&#8217;<br />
start = 2223</p>
<p>This had me foxed as I fetching band names which sometimes had a fancy character in them: Motörhead for example.</p>
<p>To allow the string to be rendered using the following:</p>
<pre name="code" class="python">unicode_string = unicode(string_with_char_init)
self.response.out.write(unicode_string.encode('utf-8'))</pre>
<p>Thats it! For App Engine that works both to render to the page or to use in urlfetch.fetch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/02/app-engine-and-utf-8-ecoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bit.ly Competition Entry</title>
		<link>http://www.chrishannam.co.uk/2009/01/bitly-competition-entry/</link>
		<comments>http://www.chrishannam.co.uk/2009/01/bitly-competition-entry/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 23:35:40 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[bit.ly]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=100</guid>
		<description><![CDATA[Below is the raw code to make a Google App Engine application with the really basic bit.ly api. Theres currently no error checking etc. If you just want the functionality use the BitLy class in your App Engine code. Currently is just returns simple for you to use. So for example with shorten to access [...]]]></description>
			<content:encoded><![CDATA[<p>Below is the raw code to make a Google App Engine application with the really basic bit.ly api. Theres currently no error checking etc.</p>
<p>If you just want the functionality use the BitLy class in your App Engine code. Currently is just returns simple for you to use. So for example with shorten to access the the hash you would use: json['results'][urlentered]['hash']. Replace the url entered with the url you supplied.</p>
<p>Any questions please email ch at chrishannam dot co dot uk</p>
<pre name="code" class="python">
import cgi

from django.utils import simplejson

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
from google.appengine.api import urlfetch

class Index(webapp.RequestHandler):
	def get(self):

		EXPAND = "expand"
		SHORTEN = "shorten"
		INFO = "info"
		STATS = "stats"
		ERRORS = "errors"

		bitly = BitLy('your_login','your_apikey')

		self.response.out.write('')
		self.response.out.write(bitly.expand('31IqMl'))
		self.response.out.write(bitly.shorten('http://www.chrishannam.co.uk'))
		self.response.out.write(bitly.info('31IqMl'))
		self.response.out.write(bitly.stats('http://bit.ly/31IqMl'))
		self.response.out.write(bitly.errors())
		self.response.out.write('')

class BitLy():
	def __init__(self, login, apikey):
		self.login = login
		self.apikey = apikey

	def expand(self,param):
		request = "http://api.bit.ly/expand?version=2.0.1&amp;shortUrl=http://bit.ly/"
		request += param
		request += "&amp;login=" + self.login + "&amp;apiKey=" +self.apikey

		result = urlfetch.fetch(request)
		json = simplejson.loads(result.content)
		return json

	def shorten(self,param):
		url = "http://" + param
		request = "http://api.bit.ly/shorten?version=2.0.1&amp;longUrl="
		request += url
		request += "&amp;login=" + self.login + "&amp;apiKey=" +self.apikey

		result = urlfetch.fetch(request)
		json = simplejson.loads(result.content)
		return json

	def info(self,param):
		request = "http://api.bit.ly/info?version=2.0.1&amp;hash="
		request += param
		request += "&amp;login=" + self.login + "&amp;apiKey=" +self.apikey

		result = urlfetch.fetch(request)
		json = simplejson.loads(result.content)
		return json

	def stats(self,param):
		request = "http://api.bit.ly/stats?version=2.0.1&amp;shortUrl="
		request += param
		request += "&amp;login=" + self.login + "&amp;apiKey=" +self.apikey

		result = urlfetch.fetch(request)
		json = simplejson.loads(result.content)
		return json

	def errors(self):
		request += "http://api.bit.ly/errors?version=2.0.1&amp;login=" + self.login + "&amp;apiKey=" +self.apikey

		result = urlfetch.fetch(request)
		json = simplejson.loads(result.content)
		return json

application = webapp.WSGIApplication(
                                     [('/', Index)],
                                     debug=True)

def main():
  run_wsgi_app(application)

if __name__ == "__main__":
  main()</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/01/bitly-competition-entry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Woe is pylast.py</title>
		<link>http://www.chrishannam.co.uk/2009/01/woe-is-pylastpy/</link>
		<comments>http://www.chrishannam.co.uk/2009/01/woe-is-pylastpy/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 23:54:19 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=84</guid>
		<description><![CDATA[Well it tested OK my local machine but deploying it to Google created some issues. In short its just CPU hungry: 01-04 03:39PM 50.602 This request used a high amount of CPU, and was roughly 2.1 times over the average request CPU limit. High CPU requests have a small quota, and if you exceed this [...]]]></description>
			<content:encoded><![CDATA[<p>Well it tested OK my local machine but deploying it to Google created some issues. In short its just CPU hungry:</p>
<p>01-04 03:39PM 50.602</p>
<p>This request used a high amount of CPU, and was roughly 2.1 times over the average request CPU limit. High CPU requests have a small quota, and if you exceed this quota, your app will be temporarily disabled.</p>
<p>I removed some of the xml processing as by default it gets everything you might need. This sped it up slightly but still the fatal 500 error appeared.</p>
<p>Well for once it appears I was right to reinvent the wheel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/01/woe-is-pylastpy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making pylast.py play with Google App Engine</title>
		<link>http://www.chrishannam.co.uk/2009/01/making-pylastpy-play-with-google-app-engine/</link>
		<comments>http://www.chrishannam.co.uk/2009/01/making-pylastpy-play-with-google-app-engine/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 23:20:43 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[App Engine]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=80</guid>
		<description><![CDATA[I have been playing with Google App Engine and last.fm&#8217;s api for a while now. I made the standard mistake of not checking if anyone else had written a library in Python to do the hard work for me. So, after a little googling I found pyLast which is a great piece of work by [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing with Google App Engine and last.fm&#8217;s api for a while now. I made the standard mistake of not checking if anyone else had written a library in Python to do the hard work for me. So, after a little googling I found <a href="http://code.google.com/p/pylast/">pyLast</a> which is a great piece of work by Amr Hassan. After a little playing I found that it didn&#8217;t play well with App Engine. This was down to the it not using urlfetch, which is no big surprise as thats a feature unique to App Engine. I also noticed it was missing the ability to fetch the date and start time of an event.</p>
<p>So below is a patch to App Engine up the code and fetch the date/time of an event. There is a slight oddity I have yet to figure out, the time gets appended to the date. I cant see any sane reason why currently.</p>
<p>Be warned this breaks the module for standard Python use unless you are have google.appengine.api kicking around in your module path.</p>
<p>If you wish to try out my App Engine app its over at <a href="http://cassandra.appspot.com">Cassandra</a>. Just enter the name of the artist to find out where they are playing displayed on Google Maps. Its very much an ongoing project&#8230;</p>
<pre name="code" class="python">
diff pylast.py pylast.py.orig
37d36
< from google.appengine.api import urlfetch
286,287c285,292
< 			request = 'http://' + API_SERVER + API_SUBDIR + '?method=' + '&#038;'.join(data)
< 			response = urlfetch.fetch(request)
---
> 			conn = httplib.HTTPConnection(API_SERVER)
> 			headers = {
> 				"Content-type": "application/x-www-form-urlencoded",
> 				'Accept-Charset': 'utf-8',
> 				'User-Agent': __name__ + '/' + __version__
> 				}
> 			conn.request('POST', API_SUBDIR, '&#038;'.join(data), headers)
> 			response = conn.getresponse()
292c297
< 		doc = minidom.parseString(response.content)
---
> 		doc = minidom.parse(response)
404a410
>
1391,1392d1396
< 		data['date'] = self._extract(doc, 'startDate')
< 		data['time'] = self._extract(doc, 'startTime')
1482,1497c1486
<
< 	def getStartDate(self):
< 		"""Returns the start date of the event """
<
< 		return self._getCachedInfo('date')
<
< 	def getStartTime(self):
< 		"""Returns the start time of the event """
<
< 		return self._getCachedInfo('time')
<
< 	def getReviewCount(self):
< 		"""Returns the number of available reviews for this event. """
<
< 		return self._getCachedInfo('reviews')
<
---
>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2009/01/making-pylastpy-play-with-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Banshee&#8217;s Database</title>
		<link>http://www.chrishannam.co.uk/2008/12/banshees-database/</link>
		<comments>http://www.chrishannam.co.uk/2008/12/banshees-database/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 13:09:54 +0000</pubDate>
		<dc:creator>channam</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.chrishannam.co.uk/?p=71</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing with Banshee the media player for Linux.</p>
<p>Its database is just a sqlite3 database. This makes getting data out very simple e.g.</p>
<pre name="code" class="python">
:~$ 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
</pre>
<p>I used -1 on my banshee path as I`m running the latest version not available from the standard repos for Ubuntu.</p>
<p>To talk to the database from python use the following:</p>
<pre name="code" class="python">
:~$ 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""")
<sqlite3.Cursor object at 0x9ab0d70>
>>> print c.fetchall()
[(u'Cradle of Filth',), (u'ACDC',), (u'Alice in Chains',), (u'A Perfect Circle',)]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chrishannam.co.uk/2008/12/banshees-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

