importsongs no longer has a static category list

This commit is contained in:
mnvdk 2020-04-26 22:56:31 +02:00
parent 41ddbb66a9
commit 387d1268fd

View File

@ -38,25 +38,18 @@
"oni": 3,
"ura": 4
}
this.categories = {
"ボーカロイド曲": "ボーカロイド™曲",
"ボーカロイド": "ボーカロイド™曲",
"vocaloid music": "ボーカロイド™曲",
"vocaloid": "ボーカロイド™曲",
"バラエティー": "バラエティ",
"どうよう": "バラエティ",
"童謡・民謡": "バラエティ",
"children": "バラエティ",
"children/folk": "バラエティ",
"children-folk": "バラエティ",
"クラッシック": "クラシック",
"classic": "クラシック"
}
for(var i in allStrings){
for(var ja in allStrings[i].categories){
this.categories[allStrings[i].categories[ja].toLowerCase()] = ja
this.categoryAliases = {}
assets.categories.forEach(cat => {
this.categoryAliases[cat.title.toLowerCase()] = cat.title.toLowerCase()
if(cat.aliases != null){
cat.aliases.forEach(alias => {
this.categoryAliases[alias.toLowerCase()] = cat.title.toLowerCase()
});
}
}
});
this.assetSelectors = {
"bg-pattern-1": ".pattern-bg",
"bg_genre_0": "#song-select",
@ -137,7 +130,7 @@
var equalsPos = line.indexOf("=")
if(equalsPos !== -1 && line.slice(0, equalsPos).trim() === "genrename"){
var value = line.slice(equalsPos + 1).trim()
category = this.categories[value] || data[i].trim().slice(equalsPos + 1).trim()
category = this.categoryAliases[value] || data[i].trim().slice(equalsPos + 1).trim()
break
}
}
@ -147,12 +140,12 @@
var line = data[i].trim().toLowerCase()
if(line.startsWith("#title:")){
var value = line.slice(7).trim()
if(value in this.categories){
category = this.categories[value]
if(value in this.categoryAliases){
category = this.categoryAliases[value]
}
}else if(line.startsWith("#genre:")){
var value = line.slice(7).trim()
category = this.categories[value] || data[i].trim().slice(7).trim()
category = this.categoryAliases[value] || data[i].trim().slice(7).trim()
break
}
}
@ -215,7 +208,6 @@
var subtitleLang = {}
var dir = file.webkitRelativePath.toLowerCase()
dir = dir.slice(0, dir.lastIndexOf("/") + 1)
var hasCategory = false
for(var diff in tja.metadata){
var meta = tja.metadata[diff]
songObj.title = meta.title || file.name.slice(0, file.name.lastIndexOf("."))
@ -234,7 +226,7 @@
songObj.music = this.otherFiles[dir + meta.wave.toLowerCase()] || songObj.music
}
if(meta.genre){
songObj.category = this.categories[meta.genre.toLowerCase()] || meta.genre
songObj.category = this.categoryAliases[meta.genre.toLowerCase()] || meta.genre
}
if(meta.taikowebskin){
songObj.song_skin = this.getSkin(dir, meta.taikowebskin)
@ -445,9 +437,9 @@
}
}
if(!hasTitle){
for(var cat in this.categories){
for(var cat in this.categoryAliases){
if(path[i].indexOf(cat) !== -1){
return this.categories[cat]
return this.categoryAliases[cat]
}
}
}