mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-12 22:59:31 +01:00
Merge branch 'develop'
This commit is contained in:
@@ -23,3 +23,21 @@ def getAlbumArt(albumid):
|
||||
url = 'http://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg' % asin
|
||||
|
||||
return url
|
||||
|
||||
def getCachedArt(albumid):
|
||||
|
||||
from headphones import cache
|
||||
|
||||
c = cache.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
|
||||
|
||||
@@ -13,8 +13,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
import music_encoder
|
||||
import urllib, shutil, re
|
||||
from headphones import notifiers
|
||||
@@ -235,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 = albumart.getCachedArt(albumid)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user