From d703e8785157dfab16020e42613029978f1fea54 Mon Sep 17 00:00:00 2001 From: Krateng Date: Fri, 21 Dec 2018 19:13:24 +0100 Subject: [PATCH] QoL fixes --- cleanup.py | 2 ++ database.py | 6 +++++- fixexisting.py | 3 +++ rules/rules.info | 2 -- website/issues.html | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cleanup.py b/cleanup.py index 94ee2ee..91f72da 100644 --- a/cleanup.py +++ b/cleanup.py @@ -25,6 +25,8 @@ class CleanerAgent: (title,moreartists) = self.parseTitleForArtists(title) artists += moreartists + artists.sort() + return (list(set(artists)),title) def removespecial(self,s): diff --git a/database.py b/database.py index df9980c..b102597 100644 --- a/database.py +++ b/database.py @@ -496,6 +496,8 @@ def issues(): @dbserver.post("/rebuild") def rebuild(): + global db_rulestate + db_rulestate = False sync() os.system("python3 fixexisting.py") global cla, coa @@ -585,7 +587,9 @@ def sync(): t = getScrobbleObject(SCROBBLES[idx]) - artistss = "␟".join(t["artists"]) + artistlist = list(t["artists"]) + artistlist.sort() #we want the order of artists to be deterministic so when we update files with new rules a diff can see what has actually been changed + artistss = "␟".join(artistlist) timestamp = datetime.date.fromtimestamp(t["time"]) entry = [str(t["time"]),artistss,t["title"]] diff --git a/fixexisting.py b/fixexisting.py index e584776..8a838cd 100644 --- a/fixexisting.py +++ b/fixexisting.py @@ -18,6 +18,7 @@ for fn in os.listdir("scrobbles/"): a = a.replace("␟",";") (al,t) = wendigo.fullclean(a,t) + al.sort() a = "␟".join(al) fnew.write(r1 + a + r2 + t + r3 + "\n") #print("Artists: " + a) @@ -29,6 +30,8 @@ for fn in os.listdir("scrobbles/"): f.close() fnew.close() + os.system("diff " + "scrobbles/" + fn + "_new" + " " + "scrobbles/" + fn) + os.rename("scrobbles/" + fn + "_new","scrobbles/" + fn) checkfile = open("scrobbles/" + fn + ".rulestate","w") diff --git a/rules/rules.info b/rules/rules.info index 1ffc394..c24fc43 100644 --- a/rules/rules.info +++ b/rules/rules.info @@ -10,7 +10,6 @@ The first column defines the type of the rule: Second column is the 'wrong' spelling Third column the correct spelling replaceartist Defines and alternative spelling of an artist that should be replaced - Any artist mentioned here will automatically be replaced, there is no need for a separate belongtogether entry Second column is the 'wrong' spelling Third column the correct spelling. Use ␟ if the spelling should correct to several artists countas Defines an artist that should be counted together with another artist for chart statistics etc. @@ -29,5 +28,4 @@ belongtogether AC/DC # / and ; separate even when there are no spaces, s replacetitle 첫 사랑니 (Rum Pum Pum Pum) Rum Pum Pum Pum replaceartist Dal Shabet Dal★Shabet replaceartist Mr FijiWiji, AgNO3 Mr FijiWiji␟AgNO3 # one artist is replaced by two artists -replaceartist Selena Gomez & the Scene Selena Gomez & The Scene # note how there is a &, but we do not need an extra belongtogether entry. countas Trouble Maker HyunA diff --git a/website/issues.html b/website/issues.html index 8aa1b6c..028fa96 100644 --- a/website/issues.html +++ b/website/issues.html @@ -16,7 +16,7 @@ with your library

KEY_ISSUES Issues

-

Maloja can identify possible problems with consistency or redundancy in your library.

+

Maloja can identify possible problems with consistency or redundancy in your library. After making any changes, you should rebuild your library.