From fcc1a2542684d3a787808bcb95de8bac3501f799 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Fri, 26 Jun 2009 01:57:20 +0300 Subject: [PATCH] Use PIL as first option Instead of hildon-thumbnailer. Added few checks to artist and album --- src/album_art.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/album_art.py b/src/album_art.py index 54811f7..fc1a656 100755 --- a/src/album_art.py +++ b/src/album_art.py @@ -24,13 +24,13 @@ class MussorgskyAlbumArt: def __init__ (self): bus = dbus.SessionBus () handle = time.time() - try: - self.thumbnailer = bus.get_object ('org.freedesktop.thumbnailer', - '/org/freedesktop/thumbnailer/Generic') - except dbus.exceptions.DBusException: - if (pil_available): - self.thumbnailer = LocalThumbnailer () - else: + if (pil_available): + self.thumbnailer = LocalThumbnailer () + else: + try: + self.thumbnailer = bus.get_object ('org.freedesktop.thumbnailer', + '/org/freedesktop/thumbnailer/Generic') + except dbus.exceptions.DBusException: print "No thumbnailer available" self.thumbnailer = None @@ -59,11 +59,11 @@ class MussorgskyAlbumArt: return (filename, thumbnail) def __last_fm (self, artist, album): - if (not artist and not album): + if (not album or len (album) < 1): return URL = BASE_LASTFM + "&api_key=" + LASTFM_APIKEY - if (artist): + if (artist and len(artist) > 1): URL += "&artist=" + urllib.quote(artist) if (album): URL += "&album=" + urllib.quote(album) -- 1.7.9.5