diff --git a/maloja/database/dbcache.py b/maloja/database/dbcache.py index b01c4f8..553143e 100644 --- a/maloja/database/dbcache.py +++ b/maloja/database/dbcache.py @@ -32,7 +32,7 @@ def maintenance(): trim_cache() def print_stats(): - log(f"Cache Size: {len(cache)+len(entitycache)}, System RAM Utilization: {psutil.virtual_memory().percent}%, Cache Hits: {hits}/{hits+misses}") + log(f"Cache Size: {len(cache)} [{len(entitycache)} E], System RAM Utilization: {psutil.virtual_memory().percent}%, Cache Hits: {hits}/{hits+misses}") #print("Full rundown:") #import sys #for k in cache.keys(): @@ -77,14 +77,14 @@ def cached_wrapper_individual(inner_func): else: conn = None - global hits, misses + #global hits, misses result = {} for id in set_arg: if (inner_func,id) in entitycache: result[id] = entitycache[(inner_func,id)] - hits += 1 + #hits += 1 else: - misses += 1 + #misses += 1 remaining = inner_func(set(e for e in set_arg if e not in result),dbconn=conn) diff --git a/maloja/proccontrol/tasks/import_scrobbles.py b/maloja/proccontrol/tasks/import_scrobbles.py index 630f326..7a9a2a2 100644 --- a/maloja/proccontrol/tasks/import_scrobbles.py +++ b/maloja/proccontrol/tasks/import_scrobbles.py @@ -60,15 +60,15 @@ def import_scrobbles(fromfile): "track":{ "artists":scrobble['artists'], "title":scrobble['title'], - "album":{ - "name":scrobble['album'], - "artists":scrobble['artists'] - }, "length":None }, "duration":scrobble['duration'], "origin":"import:" + import_type, - "extra":{} + "extra":{ + "album":scrobble['album'] + # saving this in the scrobble instead of the track because for now it's not meant + # to be authorative information, just payload of the scrobble + } }) if success % 1000 == 0: diff --git a/maloja/utilities/images.py b/maloja/utilities/images.py index b9f63b7..d0603a0 100644 --- a/maloja/utilities/images.py +++ b/maloja/utilities/images.py @@ -87,6 +87,7 @@ def remove_image_from_cache(id,table): def dl_image(url): if not malojaconfig["PROXY_IMAGES"]: return None if url is None: return None + if url.startswith("/"): return None #local image try: r = requests.get(url) mime = r.headers.get('content-type') or 'image/jpg'