diff --git a/libsaria/lastfm.py b/libsaria/lastfm.py index bf25aedd..f4da9bc6 100644 --- a/libsaria/lastfm.py +++ b/libsaria/lastfm.py @@ -61,13 +61,16 @@ def lfm_cache_album(file, artist, album): pass return False -def get_artwork(filepath): - id = file_to_id(filepath) - if id == None: - return +def get_artwork_id(id): artist = libsaria.collection.get_attr(id, "artist") 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) + +def get_artwork(filepath): + id = file_to_id(filepath) + if id == None: + return + return get_artwork_id(id) libsaria.event.invite("POSTLOAD", get_artwork, True)