mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Fixed use of # symbol in artist or track names
This commit is contained in:
parent
709f3c129c
commit
55a2383788
@ -35,7 +35,7 @@ def loadAPIkeys():
|
|||||||
global clients
|
global clients
|
||||||
createTSV("clients/authenticated_machines.tsv")
|
createTSV("clients/authenticated_machines.tsv")
|
||||||
clients = parseTSV("clients/authenticated_machines.tsv","string","string")
|
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):
|
def checkAPIkey(k):
|
||||||
return (k in [k for [k,d] in clients])
|
return (k in [k for [k,d] in clients])
|
||||||
@ -704,6 +704,7 @@ def build_db():
|
|||||||
ARTISTS.append(artist)
|
ARTISTS.append(artist)
|
||||||
|
|
||||||
coa.updateIDs(ARTISTS)
|
coa.updateIDs(ARTISTS)
|
||||||
|
|
||||||
|
|
||||||
global db_rulestate
|
global db_rulestate
|
||||||
db_rulestate = consistentRulestate("scrobbles",cla.checksums)
|
db_rulestate = consistentRulestate("scrobbles",cla.checksums)
|
||||||
|
@ -17,7 +17,7 @@ The first column defines the type of the rule:
|
|||||||
Second column is the artist
|
Second column is the artist
|
||||||
Third column the replacement artist / grouping label
|
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:
|
An example file could look like this:
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ def parseTSV(filename,*args):
|
|||||||
for l in [l for l in f if (not l.startswith("#")) and (not l.strip()=="")]:
|
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("\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
|
data = list(filter(None,l.split("\t"))) # Multiple tabs are okay, we don't accept empty fields unless trailing
|
||||||
entry = [] * len(args)
|
entry = [] * len(args)
|
||||||
for i in range(len(args)):
|
for i in range(len(args)):
|
||||||
@ -128,6 +129,7 @@ def addEntry(filename,a):
|
|||||||
createTSV(filename)
|
createTSV(filename)
|
||||||
|
|
||||||
line = "\t".join(a)
|
line = "\t".join(a)
|
||||||
|
line = line.replace("#",r"\num")
|
||||||
with open(filename,"a") as f:
|
with open(filename,"a") as f:
|
||||||
f.write(line + "\n")
|
f.write(line + "\n")
|
||||||
|
|
||||||
@ -136,6 +138,7 @@ def addEntries(filename,al):
|
|||||||
with open(filename,"a") as f:
|
with open(filename,"a") as f:
|
||||||
for a in al:
|
for a in al:
|
||||||
line = "\t".join(a)
|
line = "\t".join(a)
|
||||||
|
line = line.replace("#",r"\num")
|
||||||
f.write(line + "\n")
|
f.write(line + "\n")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user