Database fixing now finally respects existing separation

This commit is contained in:
Krateng 2020-12-02 21:08:44 +01:00
parent f62fd254dd
commit 212fbf368e
6 changed files with 18 additions and 9 deletions

View File

@ -5,7 +5,7 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,10,6
version = 2,10,7
versionstr = ".".join(str(n) for n in version)
links = {
"pypi":"malojaserver",

View File

@ -48,9 +48,12 @@ class CleanerAgent:
return (artists,title)
def removespecial(self,s):
s = s.replace("\t","").replace("","").replace("\n","")
s = re.sub(" +"," ",s)
return s
if isinstance(s,list):
return [self.removespecial(se) for se in s]
else:
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
@ -67,6 +70,10 @@ class CleanerAgent:
def parseArtists(self,a):
if isinstance(a,list):
res = [self.parseArtists(art) for art in a]
return [a for group in res for a in group]
if a.strip() in settings.get_settings("INVALID_ARTISTS"):
return []

View File

@ -148,6 +148,8 @@ replaceartist 여자친구 GFriend GFriend
# Girl's Generation
replaceartist 소녀시대 Girls' Generation
replaceartist SNSD Girls' Generation
replaceartist Girls' Generation-TTS TaeTiSeo
countas TaeTiSeo Girls' Generation
# Apink
replaceartist A Pink Apink

Can't render this file because it has a wrong number of fields in line 5.

View File

@ -577,7 +577,7 @@ def incoming_scrobble(artists,title,album=None,duration=None,time=None,fix=True)
log("Incoming scrobble (): ARTISTS: " + str(artists) + ", TRACK: " + title,module="debug")
if fix:
(artists,title) = cla.fullclean("/".join(artists),title)
(artists,title) = cla.fullclean(artists,title)
trackdict = createScrobble(artists,title,time,album,duration)
sync()

View File

@ -49,7 +49,7 @@ def fix():
a,t = re.sub(exp,r"\3",l), re.sub(exp,r"\5",l)
r1,r2,r3 = re.sub(exp,r"\1\2",l),re.sub(exp,r"\4",l),re.sub(exp,r"\6",l)
a = a.replace("",";")
a = a.split("")
(al,t) = wendigo.fullclean(a,t)
a = "".join(al)
@ -59,7 +59,7 @@ def fix():
#os.system("diff " + "scrobbles/" + fn + "_new" + " " + "scrobbles/" + fn)
with open(datadir("scrobbles",filename_new),"r") as newfile, open(datadir("scrobbles",filename),"r") as oldfile:
diff = difflib.unified_diff(oldfile.read().split("\n"),newfile.read().split("\n"),lineterm="")
diff = difflib.unified_diff(oldfile.read().split("\n"),newfile.read().split("\n"),lineterm="",n=0)
diff = list(diff)
with open(os.path.join(patchfolder,filename + ".diff"),"w") as patchfile:

View File

@ -10,7 +10,7 @@
{% block scripts %}
<script>
var pending = false;
setInterval(probeServer,1500);
setInterval(probeServer,3500);
function probeServer() {
if (!pending) {
@ -32,7 +32,7 @@
var status = response['db_status'];
console.log(response);
if (status['healthy'] && !status['rebuildinprogress']) {
window.location = "/issues";
window.location = "/admin_issues";
}
pending = false;
}