mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01:00
Fixed the info and image_url variables. Removed url from filenames
This commit is contained in:
+6
-4
@@ -37,7 +37,7 @@ class Cache(object):
|
|||||||
|
|
||||||
Call cache.getInfo(id) to grab the artist/album info; will return the text description
|
Call cache.getInfo(id) to grab the artist/album info; will return the text description
|
||||||
|
|
||||||
The basic format for art in the cache is <musicbrainzid>.<date>.<url including extension>
|
The basic format for art in the cache is <musicbrainzid>.<date>.<ext>
|
||||||
and for info it is <musicbrainzid>.<date>.txt
|
and for info it is <musicbrainzid>.<date>.txt
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -136,8 +136,8 @@ class Cache(object):
|
|||||||
try:
|
try:
|
||||||
result = urllib2.urlopen(url).read()
|
result = urllib2.urlopen(url).read()
|
||||||
data = simplejson.JSONDecoder().decode(result)
|
data = simplejson.JSONDecoder().decode(result)
|
||||||
info = artist['artist']['bio']['content']
|
info = data['artist']['bio']['content']
|
||||||
image_url = artist['artist']['image'][-1]['#text']
|
image_url = data['artist']['image'][-1]['#text']
|
||||||
except:
|
except:
|
||||||
logger.warn('Could not open url: ' + url)
|
logger.warn('Could not open url: ' + url)
|
||||||
return
|
return
|
||||||
@@ -210,7 +210,9 @@ class Cache(object):
|
|||||||
except:
|
except:
|
||||||
logger.error('Error deleting file from the cache: ' + artwork_file)
|
logger.error('Error deleting file from the cache: ' + artwork_file)
|
||||||
|
|
||||||
artwork_path = os.path.join(self.path_to_art_cache, self.id + '.' + helpers.today() + '.' + image_url.replace('/','%%%').replace(':','_%_'))
|
ext = os.path.splitext(image_url)[1]
|
||||||
|
|
||||||
|
artwork_path = os.path.join(self.path_to_art_cache, self.id + '.' + helpers.today() + ext)
|
||||||
try:
|
try:
|
||||||
f = open(artwork_path, 'wb')
|
f = open(artwork_path, 'wb')
|
||||||
f.write(artwork)
|
f.write(artwork)
|
||||||
|
|||||||
Reference in New Issue
Block a user