diff --git a/cleanup.py b/cleanup.py index 2803cc3..94ee2ee 100644 --- a/cleanup.py +++ b/cleanup.py @@ -28,7 +28,10 @@ class CleanerAgent: return (list(set(artists)),title) def removespecial(self,s): - return s.replace("\t","").replace("␟","").replace("\n","") + s = s.replace("\t","").replace("␟","").replace("\n","") + s = re.sub(" +"," ",s) + return s + # if an artist appears in any created rule, we can assume that artist is meant to exist and be spelled like that def confirmedReal(self,a): diff --git a/database.py b/database.py index 7ed53b2..df9980c 100644 --- a/database.py +++ b/database.py @@ -81,25 +81,37 @@ def readScrobble(artists,title,time): def getArtistID(name): obj = name + objlower = name.lower() + try: - i = ARTISTS.index(obj) + return ARTISTS.index(obj) + except: + pass + try: + return [a.lower() for a in ARTISTS].index(objlower) except: i = len(ARTISTS) ARTISTS.append(obj) - return i + return i def getTrackID(artists,title): artistset = set() for a in artists: artistset.add(getArtistID(name=a)) obj = (frozenset(artistset),title) + objlower = (frozenset(artistset),title.lower()) try: - i = TRACKS.index(obj) + return TRACKS.index(obj) + except: + pass + try: + # not the best performance + return [(t[0],t[1].lower()) for t in TRACKS].index(objlower) except: i = len(TRACKS) TRACKS.append(obj) - return i + return i #### diff --git a/website/maloja.css b/website/maloja.css index bcfa6fd..94b8901 100644 --- a/website/maloja.css +++ b/website/maloja.css @@ -53,7 +53,7 @@ table td.time { color:lightgray; } table td.artists,td.artist,td.title,td.amount { - width:300px; + width:350px; } table td.button {