Skip to content

Commit 91722c1

Browse files
committed
update data
1 parent e3df13e commit 91722c1

File tree

6 files changed

+296
-14
lines changed

6 files changed

+296
-14
lines changed

.idea/discord.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/tgbot/clear-cache.nu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
let tmpfile = mktemp -t --suffix .json
2-
wrangler kv key list --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 --prefix image: | from json | get name | to json | save -f $tmpfile
3-
wrangler kv bulk delete --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 -f $tmpfile
2+
wrangler kv key list --remote --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 --prefix image: | from json | get name | to json | save -f $tmpfile
3+
wrangler kv bulk delete --remote --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 -f $tmpfile
44
let tmpfile = mktemp -t --suffix .json
5-
wrangler kv key list --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 --prefix lyrics: | from json | get name | to json | save -f $tmpfile
6-
wrangler kv bulk delete --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 -f $tmpfile
5+
wrangler kv key list --remote --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 --prefix lyrics: | from json | get name | to json | save -f $tmpfile
6+
wrangler kv bulk delete --remote --namespace-id 16a7f633b5374174a3e44a4ebd4abac6 -f $tmpfile
77
rm $tmpfile

apps/tools/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"genFileIds": "tsx src/genFileIds.ts",
88
"update-allmusic-web": "scp all-music.json daisy:/etc/nginx/aqua-data/mai2/00",
9+
"update-allitems-web": "scp all-items-new.json daisy:/etc/nginx/aqua-data/mai2/00/all-items.json",
910
"update-allmusic-web-chu": "scp chu-all-music.json daisy:/etc/nginx/aqua-data/chu3/00/all-music.json"
1011
},
1112
"devDependencies": {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { ALL_MUSIC } from '@clansty/maibot-data';
2+
import fsP from 'node:fs/promises';
3+
import _ from 'lodash';
4+
5+
const allMusic = Object.entries(ALL_MUSIC)
6+
.filter(([strId, content]) => {
7+
// 移除自制谱
8+
const id = Number(strId);
9+
return id < 1e5 && id % 1e4 < 2e3;
10+
})
11+
.map(([id, content]) => ({
12+
...content,
13+
id: Number(id)
14+
}));
15+
16+
const allIds = _.uniq(allMusic.map((item) => item.id % 1e4));
17+
18+
await fsP.writeFile('./all-music-vrc.json', JSON.stringify({ allMusic, allIds }, null, 0));

apps/tools/src/updateCollections.ts

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { XMLParser } from 'fast-xml-parser';
77
const parser = new XMLParser();
88

99
for (const a of await fsP.readdir(path.join(process.argv[2]))) {
10-
if (!a.startsWith('A')) continue;
10+
if (a.length !== 4) continue;
11+
console.log(a)
1112
const base = path.join(process.argv[2], a);
1213
if (fs.existsSync(path.join(base, 'title'))) {
1314
for (const dir of await fsP.readdir(path.join(base, 'title'))) {
@@ -24,12 +25,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
2425
original.title[id] = {
2526
name: meta.TitleData.name.str.toString(),
2627
ver: meta.TitleData.releaseTagName.str.toString(),
27-
disable: "false",
28+
disable: 'false'
2829
};
2930
}
3031
}
3132
}
32-
33+
3334
if (fs.existsSync(path.join(base, 'chara'))) {
3435
for (const dir of await fsP.readdir(path.join(base, 'chara'))) {
3536
if (!fs.existsSync(path.join(base, 'chara', dir, 'Chara.xml'))) continue;
@@ -42,12 +43,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
4243
} else {
4344
original.chara[id] = {
4445
name: meta.CharaData.name.str.toString(),
45-
disable: "false",
46+
disable: 'false'
4647
};
4748
}
4849
}
4950
}
50-
51+
5152
if (fs.existsSync(path.join(base, 'frame'))) {
5253
for (const dir of await fsP.readdir(path.join(base, 'frame'))) {
5354
if (!fs.existsSync(path.join(base, 'frame', dir, 'frame.xml'))) continue;
@@ -60,12 +61,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
6061
} else {
6162
original.frame[id] = {
6263
name: meta.FrameData.name.str.toString(),
63-
disable: "false",
64+
disable: 'false'
6465
};
6566
}
6667
}
6768
}
68-
69+
6970
if (fs.existsSync(path.join(base, 'Icon'))) {
7071
for (const dir of await fsP.readdir(path.join(base, 'Icon'))) {
7172
if (!fs.existsSync(path.join(base, 'Icon', dir, 'Icon.xml'))) continue;
@@ -78,12 +79,12 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
7879
} else {
7980
original.icon[id] = {
8081
name: meta.IconData.name.str.toString(),
81-
disable: "false",
82+
disable: 'false'
8283
};
8384
}
8485
}
8586
}
86-
87+
8788
if (fs.existsSync(path.join(base, 'Plate'))) {
8889
for (const dir of await fsP.readdir(path.join(base, 'Plate'))) {
8990
if (!fs.existsSync(path.join(base, 'Plate', dir, 'Plate.xml'))) continue;
@@ -96,7 +97,25 @@ for (const a of await fsP.readdir(path.join(process.argv[2]))) {
9697
} else {
9798
original.plate[id] = {
9899
name: meta.PlateData.name.str.toString(),
99-
disable: "false",
100+
disable: 'false'
101+
};
102+
}
103+
}
104+
}
105+
106+
if (fs.existsSync(path.join(base, 'Partner'))) {
107+
for (const dir of await fsP.readdir(path.join(base, 'Partner'))) {
108+
if (!fs.existsSync(path.join(base, 'Partner', dir, 'Partner.xml'))) continue;
109+
const meta = parser.parse(await fsP.readFile(path.join(base, 'Partner', dir, 'Partner.xml'), 'utf-8'));
110+
111+
const id = meta.PartnerData.name.id.toString();
112+
const origin = original.partner[id];
113+
if (origin) {
114+
origin.name = meta.PartnerData.name.str.toString();
115+
} else {
116+
original.partner[id] = {
117+
name: meta.PartnerData.name.str.toString(),
118+
disable: 'false'
100119
};
101120
}
102121
}

0 commit comments

Comments
 (0)