From 3eff3c6aeecdefe4dc521e1a2789f46f281a71c0 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Wed, 17 Nov 2010 23:29:51 -0500 Subject: [PATCH] lastfm return None on error lastfm album art fetching should return None if there is a problem opening the image url. --- libsaria/lastfm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libsaria/lastfm.py b/libsaria/lastfm.py index 990cc88f..1eaf60a4 100644 --- a/libsaria/lastfm.py +++ b/libsaria/lastfm.py @@ -30,7 +30,10 @@ class LastFmRequest(dict): url["api_key"] = APIKEY for param in self: url[param] = self[param] - file = url.open() + try: + file = url.open() + except: + return None if file == None: return None if printfile==True: