1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added predefined rule modules

This commit is contained in:
Krateng
2019-03-24 14:56:34 +01:00
parent 2246efb4b4
commit 3f22d6bc75
10 changed files with 279 additions and 41 deletions

View File

@@ -666,6 +666,24 @@ def issues():
return {"duplicates":duplicates,"combined":combined,"newartists":newartists,"inconsistent":inconsistent}
@dbserver.post("/importrules")
def import_rulemodule():
keys = FormsDict.decode(request.forms)
filename = keys.get("filename")
remove = keys.get("remove") is not None
validchars = "'-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
filename = "".join(c for c in filename if c in validchars)
if remove:
log("Deactivating predefined rulefile " + filename)
os.remove("rules/" + filename + ".tsv")
else:
log("Importing predefined rulefile " + filename)
os.symlink("predefined/" + filename + ".tsv","rules/" + filename + ".tsv")
@dbserver.post("/rebuild")
def rebuild():