Verified Commit d9cd25b5 authored by David Sn's avatar David Sn
Browse files

Support caching for cover art images


Signed-off-by: David Sn's avatarDavid Sn <divad.nnamtdeis@gmail.com>
parent 70c5319a
......@@ -259,11 +259,16 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
logger.debug("Handling get images: %s", uris)
result = {}
# TODO Add cache
for uri in uris:
track_id = uri.split(":")[-1]
payload = self.backend.client.get_track(track_id)
cache_key = "funkwhale:images:%s" % track_id
from_cache = self.cache.get(cache_key)
if from_cache:
result[uri] = from_cache
continue
payload = self.backend.client.get_track(track_id)
if not payload["album"]["cover"]:
continue
......@@ -282,6 +287,8 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
result[uri].append(image)
self.cache.set(cache_key, result[uri])
return result
def search(self, query=None, uris=None, exact=False):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment