diff --git a/README.md b/README.md index 281801d..cf744e5 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ I like to name my projects after regions in Grisons, Switzerland. Don't waste yo ## Current status -Deep in development. I just uploaded Maloja here in case I die tomorrow. It can accept scrobbles and return some basic stats in JSON format so far. +Deep in development. I just uploaded Maloja here in case I die tomorrow. It can accept scrobbles and return a few webpages (/artist, /scrobbles, /topartists). ## How to install diff --git a/cleanup.py b/cleanup.py index b2d4c76..7330529 100644 --- a/cleanup.py +++ b/cleanup.py @@ -76,7 +76,6 @@ class CleanerAgent: return [a.strip()] def parseTitle(self,t): - if t.strip() in self.rules_replacetitle: return self.rules_replacetitle[t.strip()] diff --git a/database.py b/database.py index 2c27650..8034b3b 100644 --- a/database.py +++ b/database.py @@ -116,7 +116,7 @@ def test_server(): @dbserver.route("/scrobbles") def get_scrobbles(): - keys = request.query + keys = FormsDict.decode(request.query) r = db_query(artist=keys.get("artist"),track=keys.get("track"),since=keys.get("since"),to=keys.get("to")) r.reverse() diff --git a/fixexisting.py b/fixexisting.py new file mode 100644 index 0000000..488f448 --- /dev/null +++ b/fixexisting.py @@ -0,0 +1,32 @@ +import os +import re +from cleanup import CleanerAgent + +wendigo = CleanerAgent() + +exp = r"([0-9]*)(\t+)([^\t]+?)(\t+)([^\t]+)(\t*)([^\t]*)\n" + +for fn in os.listdir("scrobbles/"): + if fn.endswith(".tsv"): + f = open("scrobbles/" + fn) + fnew = open("scrobbles/" + fn + "_new","w") + for l in f: + + a,t = re.sub(exp,r"\3",l), re.sub(exp,r"\5",l) + r1,r2,r3 = re.sub(exp,r"\1\2",l),re.sub(exp,r"\4",l),re.sub(exp,r"\6\7",l) + + a = a.replace("␟",";") + + (al,t) = wendigo.fullclean(a,t) + a = "␟".join(al) + fnew.write(r1 + a + r2 + t + r3 + "\n") + #print("Artists: " + a) + #print("Title: " + t) + #print("1: " + r1) + #print("2: " + r2) + #print("3: " + r3) + + f.close() + fnew.close() + + os.rename("scrobbles/" + fn + "_new","scrobbles/" + fn) diff --git a/website/artist.html b/website/artist.html index 02828d0..6c54f63 100644 --- a/website/artist.html +++ b/website/artist.html @@ -16,7 +16,7 @@
KEY_SCROBBLES Scrobbles
+KEY_DESCRIPTION
" + html += " | |||
" timestring = getTimeDesc(s["time"]) html += timestring - html += " | " + html += " | " artisthtml = "" for a in s["artists"]: artisthtml += "" + a + ", " html += artisthtml[:-2] - html += " | " + s["title"] + " | " + s["title"] + " | " html += "
" + html += " | |
" html += "" + e["artist"] + "" - html += " | " + str(e["scrobbles"]) + " | " + str(e["scrobbles"]) + " | " html += "