From 87cdb9987efe08b466f99f9ccb8b808131f9fbcd Mon Sep 17 00:00:00 2001 From: Krateng Date: Wed, 5 Aug 2020 15:45:52 +0200 Subject: [PATCH] Improved some logging --- maloja/__pkginfo__.py | 2 +- maloja/compliant_api.py | 9 ++------- maloja/data_files/rules/predefined/krateng_cpop.tsv | 5 +++++ maloja/database.py | 6 ------ 4 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 maloja/data_files/rules/predefined/krateng_cpop.tsv diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 4880b26..3896945 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -5,7 +5,7 @@ author = { "email":"maloja@krateng.dev", "github": "krateng" } -version = 2,6,5 +version = 2,6,6 versionstr = ".".join(str(n) for n in version) links = { "pypi":"malojaserver", diff --git a/maloja/compliant_api.py b/maloja/compliant_api.py index ae20c26..01cdb92 100644 --- a/maloja/compliant_api.py +++ b/maloja/compliant_api.py @@ -44,11 +44,7 @@ def handler(apiname,version): return deco def handle(path,keys): - print("API request: " + str(path)) - print("Keys:") - for k in keys: - print("\t",k,":",keys.get(k)) - + log("API request: " + str(path))# + " | Keys: " + str({k:keys.get(k) for k in keys})) if len(path)>1 and (path[0],path[1]) in handlers: handler = handlers[(path[0],path[1])] @@ -63,7 +59,7 @@ def handle(path,keys): response.status = 500 - print("Response: " + str(result)) + log("Response: " + str(result)) return result def scrobbletrack(artiststr,titlestr,timestamp): @@ -182,7 +178,6 @@ class LBrnz1(APIHandler): } def get_method(self,pathnodes,keys): - print(pathnodes) return pathnodes.pop(0) def submit(self,pathnodes,keys): diff --git a/maloja/data_files/rules/predefined/krateng_cpop.tsv b/maloja/data_files/rules/predefined/krateng_cpop.tsv new file mode 100644 index 0000000..288fe8b --- /dev/null +++ b/maloja/data_files/rules/predefined/krateng_cpop.tsv @@ -0,0 +1,5 @@ +# NAME: Artists and Groups +# DESC: Combines artists that also performed as part of a group + +replaceartist SING女團 S.I.N.G. +replacetitle SING-Moonlight Thoughts Moonlight Thoughts (English Version) diff --git a/maloja/database.py b/maloja/database.py index 608da89..cff3f4a 100644 --- a/maloja/database.py +++ b/maloja/database.py @@ -717,12 +717,6 @@ def sapi(path:Multi,**keys): - -@dbserver.get("sync") -def abouttoshutdown(): - sync() - #sys.exit() - @dbserver.post("newrule") def newrule(**keys): apikey = keys.pop("key",None)