Check cache/last.fm for album art

This commit is contained in:
rembo10
2012-07-18 18:46:09 +05:30
parent f8ccde4559
commit 5bb0c01654

View File

@@ -26,7 +26,7 @@ from lib.beets import autotag
from lib.beets.mediafile import MediaFile
import headphones
from headphones import db, albumart, lyrics, logger, helpers
from headphones import db, albumart, lyrics, logger, helpers, cache
postprocessor_lock = threading.Lock()
@@ -238,8 +238,11 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list)
if headphones.EMBED_ALBUM_ART or headphones.ADD_ALBUM_ART:
artwork = urllib.urlopen(album_art_path).read()
if len(artwork) < 100:
artwork = False
logger.info("No suitable album art found. Not adding album art")
logger.info("No suitable album art found from Amazon. Checking Last.FM....")
artwork = urllib.urlopen(cache.getArtwork(AlbumID=albumid)).read()
if len(artwork) < 100:
artwork = False
logger.info("No suitable album art found from Last.FM. Not adding album art")
if headphones.EMBED_ALBUM_ART and artwork:
embedAlbumArt(artwork, downloaded_track_list)