From 886979ad36ab3527afb58223a0fd2b8a24a534e6 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Sat, 5 Jan 2019 15:24:09 +0300 Subject: [PATCH] Allow non-standard genre field, add genre to osu songs --- public/src/js/importsongs.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/src/js/importsongs.js b/public/src/js/importsongs.js index f26018c..d81241f 100644 --- a/public/src/js/importsongs.js +++ b/public/src/js/importsongs.js @@ -148,13 +148,15 @@ } if(category){ 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) if(tjaPath.startsWith(metaPath) && (!("categoryLevel" in fileObj) || fileObj.categoryLevel < level)){ fileObj.category = category fileObj.categoryLevel = level } - }) + } + this.tjaFiles.forEach(filesLoop) + this.osuFiles.forEach(filesLoop) } }).catch(() => {}) reader.readAsText(file, "sjis") @@ -193,8 +195,8 @@ if(meta.wave){ songObj.music = this.otherFiles[dir + meta.wave.toLowerCase()] } - if(meta.genre in this.categories){ - songObj.category = this.categories[meta.genre] + if(meta.genre){ + songObj.category = this.categories[meta.genre.toLowerCase()] || meta.genre } } if(!songObj.category){