SongStorage: Fix imported osu songs not getting titles

This commit is contained in:
LoveEevee 2020-03-07 10:13:50 +03:00
parent 0d13f14f45
commit ac0483b389

View File

@ -304,8 +304,7 @@
subtitle_lang: osu.metadata.Artist || osu.metadata.ArtistUnicode, subtitle_lang: osu.metadata.Artist || osu.metadata.ArtistUnicode,
preview: osu.generalInfo.PreviewTime / 1000, preview: osu.generalInfo.PreviewTime / 1000,
stars: [null, null, null, parseInt(osu.difficulty.overallDifficulty) || 1], stars: [null, null, null, parseInt(osu.difficulty.overallDifficulty) || 1],
music: this.otherFiles[dir + osu.generalInfo.AudioFilename.toLowerCase()] || "muted", music: this.otherFiles[dir + osu.generalInfo.AudioFilename.toLowerCase()] || "muted"
hash: md5.base64(event.target.result).slice(0, -2)
} }
var filename = file.name.slice(0, file.name.lastIndexOf(".")) var filename = file.name.slice(0, file.name.lastIndexOf("."))
var title = osu.metadata.TitleUnicode || osu.metadata.Title var title = osu.metadata.TitleUnicode || osu.metadata.Title
@ -322,6 +321,13 @@
} }
this.songs[index] = songObj this.songs[index] = songObj
songObj.category = category || this.getCategory(file) songObj.category = category || this.getCategory(file)
var hash = md5.base64(event.target.result).slice(0, -2)
songObj.hash = hash
scoreStorage.songTitles[songObj.title] = hash
var score = scoreStorage.get(hash)
if(score){
score.title = songObj.title
}
}).catch(() => {}) }).catch(() => {})
reader.readAsText(file) reader.readAsText(file)
return promise return promise