Allow non-standard genre field, add genre to osu songs

This commit is contained in:
LoveEevee 2019-01-05 15:24:09 +03:00
parent 8bc9aee594
commit 886979ad36

View File

@ -148,13 +148,15 @@
} }
if(category){ if(category){
var metaPath = file.webkitRelativePath.toLowerCase().slice(0, file.name.length * -1) var metaPath = file.webkitRelativePath.toLowerCase().slice(0, file.name.length * -1)
this.tjaFiles.forEach(fileObj => { var filesLoop = fileObj => {
var tjaPath = fileObj.file.webkitRelativePath.toLowerCase().slice(0, fileObj.file.name.length * -1) var tjaPath = fileObj.file.webkitRelativePath.toLowerCase().slice(0, fileObj.file.name.length * -1)
if(tjaPath.startsWith(metaPath) && (!("categoryLevel" in fileObj) || fileObj.categoryLevel < level)){ if(tjaPath.startsWith(metaPath) && (!("categoryLevel" in fileObj) || fileObj.categoryLevel < level)){
fileObj.category = category fileObj.category = category
fileObj.categoryLevel = level fileObj.categoryLevel = level
} }
}) }
this.tjaFiles.forEach(filesLoop)
this.osuFiles.forEach(filesLoop)
} }
}).catch(() => {}) }).catch(() => {})
reader.readAsText(file, "sjis") reader.readAsText(file, "sjis")
@ -193,8 +195,8 @@
if(meta.wave){ if(meta.wave){
songObj.music = this.otherFiles[dir + meta.wave.toLowerCase()] songObj.music = this.otherFiles[dir + meta.wave.toLowerCase()]
} }
if(meta.genre in this.categories){ if(meta.genre){
songObj.category = this.categories[meta.genre] songObj.category = this.categories[meta.genre.toLowerCase()] || meta.genre
} }
} }
if(!songObj.category){ if(!songObj.category){