839
839
# - None if an error occures
840
840
# - The file's URI as string if downloading was succesfull
841
841
def get_album_image(self, album_id, size = 100):
843
download_from = "http://imgjam.com/albums/s%s/%s/covers/1.%i.jpg" % (str(album_id)[0:2], album_id, size)
843
844
name = "http://api.jamendo.com/get2/image/album/redirect/?id=%s&imagesize=%i" % (album_id, size)
844
845
md5hash = hashlib.md5(name).hexdigest()
845
846
fh = os.path.join(self.home, "images", md5hash)
846
847
if not os.path.exists(fh):
849
850
urllib.urlretrieve(download_from, fh)
851
852
print ("Could not load image")