From 37fd8c953cf08155f98735cb58f976b9f3a1cf3b Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 7 Nov 2010 16:18:32 -0500 Subject: [PATCH] get_artwork_id() If I already have the song id, there is no reason I should have to look up the filepath to set the artwork. --- libsaria/lastfm.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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)