mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-03 03:29:26 +01:00
Fixed path for getting cached album art in postprocessor
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from headphones import db
|
||||
from headphones import db, cache
|
||||
|
||||
def getAlbumArt(albumid):
|
||||
|
||||
@@ -23,3 +23,18 @@ def getAlbumArt(albumid):
|
||||
url = 'http://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % asin
|
||||
|
||||
return url
|
||||
|
||||
def getCachedArt(albumid):
|
||||
|
||||
c = Cache()
|
||||
artwork_path = c.get_artwork_from_cache(AlbumID=albumid)
|
||||
|
||||
if not artwork_path:
|
||||
return None
|
||||
|
||||
if artwork_path.startswith('http://'):
|
||||
artwork = urllib.urlopen(artwork_path).read()
|
||||
return artwork
|
||||
else:
|
||||
artwork = open(artwork_path, "r").read()
|
||||
return artwork
|
||||
|
||||
@@ -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, cache
|
||||
from headphones import db, albumart, lyrics, logger, helpers
|
||||
|
||||
postprocessor_lock = threading.Lock()
|
||||
|
||||
@@ -239,7 +239,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list)
|
||||
artwork = urllib.urlopen(album_art_path).read()
|
||||
if len(artwork) < 100:
|
||||
logger.info("No suitable album art found from Amazon. Checking Last.FM....")
|
||||
artwork = urllib.urlopen(cache.getArtwork(AlbumID=albumid)).read()
|
||||
artwork = albumart.getCachedArt(albumid)
|
||||
if len(artwork) < 100:
|
||||
artwork = False
|
||||
logger.info("No suitable album art found from Last.FM. Not adding album art")
|
||||
|
||||
Reference in New Issue
Block a user