Added 'art' to library attrs
This attribute will return the path to the cached album art for the song.
This commit is contained in:
parent
37fd8c953c
commit
b7559e7864
|
@ -76,6 +76,9 @@ def get_attr(id, attr):
|
|||
return rec.lenstr
|
||||
if attr == "score":
|
||||
return rec.score
|
||||
if attr == "art":
|
||||
from libsaria import lastfm
|
||||
return lastfm.get_artwork_id(id)
|
||||
|
||||
tags = rec.tags.walk_backwards()
|
||||
if attr == "artist":
|
||||
|
|
|
@ -66,11 +66,12 @@ def get_artwork_id(id):
|
|||
album = libsaria.collection.get_attr(id, "album")
|
||||
cached = cache[artist]
|
||||
file = cached.get("%s.jpg" % album, lfm_cache_album, artist, album)
|
||||
libsaria.event.start("POSTGETART", file)
|
||||
return file
|
||||
|
||||
def get_artwork(filepath):
|
||||
id = file_to_id(filepath)
|
||||
if id == None:
|
||||
return
|
||||
return get_artwork_id(id)
|
||||
file = get_artwork_id(id)
|
||||
libsaria.event.start("POSTGETART", file)
|
||||
libsaria.event.invite("POSTLOAD", get_artwork, True)
|
||||
|
|
Loading…
Reference in New Issue