From 4994e59846d67804b0cbd9d98cc7542af19d7d76 Mon Sep 17 00:00:00 2001 From: Krateng Date: Wed, 6 Mar 2019 18:04:12 +0100 Subject: [PATCH] Fixed image redirect issue --- server.py | 1 + utilities.py | 4 +++- website/maloja.css | 9 +++------ website/start.html | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index 918ca70..bab37d1 100755 --- a/server.py +++ b/server.py @@ -83,6 +83,7 @@ def dynamic_image(): keys = FormsDict.decode(request.query) relevant, _, _, _ = KeySplit(keys) result = resolveImage(**relevant) + if result == "": return "" redirect(result,301) @webserver.route("/images/") diff --git a/utilities.py b/utilities.py index 7e0042e..cf34ec0 100644 --- a/utilities.py +++ b/utilities.py @@ -259,7 +259,7 @@ def loadCache(): fl.close() def getTrackInfo(artists,title,fast=False): - + obj = (frozenset(artists),title) filename = "-".join([re.sub("[^a-zA-Z0-9]","",artist) for artist in artists]) + "_" + re.sub("[^a-zA-Z0-9]","",title) if filename == "": filename = str(hash(obj)) @@ -319,11 +319,13 @@ def getArtistInfo(artist,fast=False): except: pass + # fast request only retuns cached and local results, generates redirect link for rest if fast: return "/image?artist=" + urllib.parse.quote(artist) + result = apirequest(artist=artist) if result.get("image") is not None: cachedArtists[artist] = result["image"] diff --git a/website/maloja.css b/website/maloja.css index fa117e2..f2efad6 100644 --- a/website/maloja.css +++ b/website/maloja.css @@ -26,10 +26,10 @@ a:hover { /** -Header +Header (unused) **/ - +/** div.header { position:fixed; height:45px; @@ -48,7 +48,7 @@ div.header { div.header h1 { margin:5px; } - +**/ /** @@ -469,9 +469,6 @@ div.sidelist { background-color:#444447; padding-left:30px; padding-right:30px; - /** - padding-top:60px; - **/ } } diff --git a/website/start.html b/website/start.html index 31b2eeb..51dc42f 100644 --- a/website/start.html +++ b/website/start.html @@ -115,6 +115,9 @@ } function clearresults() { + window.setTimeout(reallyclear,500) + } + function reallyclear() { document.getElementById("resultwrap").innerHTML = ""; }