fix: fixed update

This commit is contained in:
Haoyu Xu
2025-10-12 22:01:35 +08:00
parent e80ef12fa1
commit a57f6861c5
2 changed files with 13 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ import path from 'node:path'
import { files as backgroundFiles } from '@aklive2d/background' import { files as backgroundFiles } from '@aklive2d/background'
import config from '@aklive2d/config' import config from '@aklive2d/config'
import { githubDownload } from '@aklive2d/downloader' import { githubDownload } from '@aklive2d/downloader'
import { file } from '@aklive2d/libs' import { envParser, file } from '@aklive2d/libs'
import type { import type {
AudioDataTable, AudioDataTable,
DisplayMetaTable, DisplayMetaTable,
@@ -50,6 +50,15 @@ const download = async () => {
} }
const generateMapping = () => { const generateMapping = () => {
const { mode } = envParser.parse({
mode: {
type: 'string',
short: 'm',
},
})
if (mode === 'update') {
return
}
const musicFolder = DATA_DIR const musicFolder = DATA_DIR
const musicTableContent = file.readSync(MUSIC_TABLE_JSON) const musicTableContent = file.readSync(MUSIC_TABLE_JSON)
const musicTable: MusicTable = musicTableContent const musicTable: MusicTable = musicTableContent
@@ -137,7 +146,8 @@ export const update = async () => {
const musicData: MusicDataItem[] = const musicData: MusicDataItem[] =
metaTable.homeBackgroundData.homeBgDataList.reduce((acc, cur) => { metaTable.homeBackgroundData.homeBgDataList.reduce((acc, cur) => {
if (cur.multiFormList.length > 1) if (cur.multiFormList.length > 1)
console.warn(`${cur.bgId} has multiple musicIds`) // TODO: support multiple backgrounds
console.warn(`${cur.bgId} has multiple musicIds`, cur.multiFormList)
acc.push({ acc.push({
id: cur.bgId, id: cur.bgId,
musicId: cur.multiFormList[0].bgMusicId, musicId: cur.multiFormList[0].bgMusicId,

View File

@@ -8,6 +8,7 @@
"@aklive2d/config": "workspace:*", "@aklive2d/config": "workspace:*",
"@aklive2d/libs": "workspace:*", "@aklive2d/libs": "workspace:*",
"@aklive2d/official-info": "workspace:*", "@aklive2d/official-info": "workspace:*",
"@aklive2d/downloader": "workspace:*",
"unidecode": "^1.1.0", "unidecode": "^1.1.0",
"yaml": "^2.8.1" "yaml": "^2.8.1"
}, },