From 55a2383788fa93b02f52e7d549db2ada4fc1aa1d Mon Sep 17 00:00:00 2001 From: Krateng Date: Mon, 11 Mar 2019 14:32:53 +0100 Subject: [PATCH] Fixed use of # symbol in artist or track names --- database.py | 3 ++- rules/rules.info | 2 +- utilities.py | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/database.py b/database.py index 2e15a9f..5c72e66 100644 --- a/database.py +++ b/database.py @@ -35,7 +35,7 @@ def loadAPIkeys(): global clients createTSV("clients/authenticated_machines.tsv") clients = parseTSV("clients/authenticated_machines.tsv","string","string") - log(str(len(clients)) + " Authenticated Machines " + ", ".join([m[1] for m in clients])) + log("Authenticated Machines: " + ", ".join([m[1] for m in clients])) def checkAPIkey(k): return (k in [k for [k,d] in clients]) @@ -704,6 +704,7 @@ def build_db(): ARTISTS.append(artist) coa.updateIDs(ARTISTS) + global db_rulestate db_rulestate = consistentRulestate("scrobbles",cla.checksums) diff --git a/rules/rules.info b/rules/rules.info index c24fc43..9b70c60 100644 --- a/rules/rules.info +++ b/rules/rules.info @@ -17,7 +17,7 @@ The first column defines the type of the rule: Second column is the artist Third column the replacement artist / grouping label -Rules in non-tsv files are ignored. '#' is used for comments. +Rules in non-tsv files are ignored. '#' is used for comments. Additional columns are ignored. To have a '#' in a name, use '\num' An example file could look like this: diff --git a/utilities.py b/utilities.py index cccb00e..9387a99 100644 --- a/utilities.py +++ b/utilities.py @@ -16,6 +16,7 @@ def parseTSV(filename,*args): for l in [l for l in f if (not l.startswith("#")) and (not l.strip()=="")]: l = l.replace("\n","").split("#")[0] + l = l.replace(r"\num","#") data = list(filter(None,l.split("\t"))) # Multiple tabs are okay, we don't accept empty fields unless trailing entry = [] * len(args) for i in range(len(args)): @@ -128,6 +129,7 @@ def addEntry(filename,a): createTSV(filename) line = "\t".join(a) + line = line.replace("#",r"\num") with open(filename,"a") as f: f.write(line + "\n") @@ -136,6 +138,7 @@ def addEntries(filename,al): with open(filename,"a") as f: for a in al: line = "\t".join(a) + line = line.replace("#",r"\num") f.write(line + "\n")