diff --git a/headphones/albumart.py b/headphones/albumart.py index 47981662..ee437bb2 100644 --- a/headphones/albumart.py +++ b/headphones/albumart.py @@ -21,6 +21,9 @@ def getAlbumArt(albumid): myDB = db.DBConnection() asin = myDB.action('SELECT AlbumASIN from albums WHERE AlbumID=?', [albumid]).fetchone()[0] + if not asin: + return None + url = 'http://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % asin return url diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index ba4f5169..a78e753e 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -240,8 +240,9 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list) album_art_path = albumart.getAlbumArt(albumid) if headphones.EMBED_ALBUM_ART or headphones.ADD_ALBUM_ART: - artwork = urllib.urlopen(album_art_path).read() - if len(artwork) < 100: + if album_art_path: + artwork = urllib.urlopen(album_art_path).read() + if not album_art_path or len(artwork) < 100: logger.info("No suitable album art found from Amazon. Checking Last.FM....") artwork = albumart.getCachedArt(albumid) if not artwork or len(artwork) < 100: