feat: support ECS8 -> 10.5 and SRPG3 -> 5

This commit is contained in:
zkldi
2022-06-12 14:05:56 +01:00
parent 6528addace
commit 89b6e52e37
11 changed files with 50283 additions and 144396 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
[]
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -40,7 +40,7 @@
"monk": "^7.3.4",
"node-fetch": "2.6.7",
"prudence": "^0.9.7",
"tachi-common": "0.11.5",
"tachi-common": "0.14.1",
"ts-node": "^10.4.0",
"xml2js": "^0.4.23"
},
+4 -4
View File
@@ -25,7 +25,7 @@ specifiers:
node-fetch: 2.6.7
prettier: ^2.5.1
prudence: ^0.9.7
tachi-common: 0.11.5
tachi-common: 0.14.1
ts-node: ^10.4.0
typescript: ^4.5.5
xml2js: ^0.4.23
@@ -48,7 +48,7 @@ dependencies:
monk: 7.3.4
node-fetch: 2.6.7
prudence: 0.9.7
tachi-common: 0.11.5
tachi-common: 0.14.1
ts-node: 10.4.0_40146b36d18138e3202fbb722e5f65e4
xml2js: 0.4.23
@@ -3113,8 +3113,8 @@ packages:
engines: {node: '>= 0.4'}
dev: true
/tachi-common/0.11.5:
resolution: {integrity: sha512-MCaDj8nLjhA8QezlKGU6iZ7RM3wSvgXIsOiMGY6bk0Cfwji/dSHfaMEkbc4sdiLZUXbzUKcVseL30G4GezL10w==}
/tachi-common/0.14.1:
resolution: {integrity: sha512-CExMkbp883M/0E/ogGBlF8APhdfs4Sm0x6ZOi98zHYhNIunCMXbQMnokF98y+1wMJfAhuStQ7CcUq1xkjMBi1w==}
dependencies:
'@types/express-serve-static-core': 4.17.28
'@types/mongodb': 3.6.18
@@ -11,7 +11,7 @@ const options = program.opts();
const data = JSON.parse(fs.readFileSync(options.file, "utf-8"));
let freshID = ReadCollection("songs-itg.json").length;
let freshID = options.append ? ReadCollection("songs-itg.json").length : 1;
const songs = [];
const charts = [];
@@ -28,7 +28,9 @@ for (const [key, d] of Object.entries(data)) {
let eastCoast = false;
// only parse these for now
if (pack.startsWith("ECS") || pack.startsWith("Stamina RPG")) {
if (pack.startsWith("ECS") && !pack.startsWith("ECS7")) {
eastCoast = true;
} else if (pack.startsWith("Stamina RPG")) {
eastCoast = true;
} else if (pack.startsWith("The Starter Pack of Stamina")) {
eastCoast = false;
@@ -103,11 +105,12 @@ for (const [key, d] of Object.entries(data)) {
level: d.level.toString(),
levelNum: d.level,
isPrimary: true,
difficulty,
playtype: "Single",
difficulty: `${d.charter}: ${difficulty}`,
playtype: "Stamina",
tierlistInfo: {},
versions: [],
data: {
difficultyTag: difficulty,
chartHash: d.chartHash,
tech: d.tech,
breakdown: d.breakdown,
@@ -34,9 +34,15 @@ for (const collection of collections) {
const validator = SCHEMAS[collection];
let game = "";
if (collection.startsWith("songs-") || collection.startsWith("charts-")) {
game = collection.split("-")[1];
}
for (const d of data) {
// Will throw if formatFn is undefined -- that's a test failure in my book.
const pretty = formatFn(d);
const pretty = formatFn(d, game);
try {
validator(d);
@@ -9,7 +9,7 @@ let fails = 0;
const folders = ReadCollection("folders.json", true) as FolderDocument[];
for (const folder of folders) {
const pretty = FormatFunctions.folders!(folder);
const pretty = FormatFunctions.folders!(folder, null);
const expectedFolderID = CreateFolderID(folder.data, folder.game, folder.playtype);
+9 -1
View File
@@ -47,6 +47,8 @@ UniqueKeys["charts-bms"].push("data.hashSHA256");
UniqueKeys["charts-pms"].push(["data.hashMD5", "playtype"]);
UniqueKeys["charts-pms"].push(["data.hashSHA256", "playtype"]);
UniqueKeys["charts-itg"].push("data.chartHash");
let exitCode = 0;
const suites = [];
@@ -61,11 +63,17 @@ for (const [collection, uniqueIDs] of Object.entries(UniqueKeys)) {
const data = ReadCollection(collectionName);
let game = "";
if (collection.startsWith("songs-") || collection.startsWith("charts-")) {
game = collection.split("-")[1];
}
for (const uniqueID of uniqueIDs) {
const set = new Set<string>();
for (const d of data) {
const pretty = formatFn(d);
const pretty = formatFn(d, game);
let pureValue: string;
let value: string;
@@ -16,7 +16,7 @@ for (const folder of folders) {
const tables = ReadCollection("tables.json", true) as TableDocument[];
for (const table of tables) {
const pretty = FormatFunctions.tables!(table);
const pretty = FormatFunctions.tables!(table, null);
for (const folderID of table.folders) {
if (!folderMap.get(folderID)) {
+22 -2
View File
@@ -1,12 +1,29 @@
import { Game } from "tachi-common";
import { allSupportedGames } from "tachi-common/js/config/static-config";
import { SCHEMAS } from "tachi-common/js/lib/schemas";
import { ReadCollection } from "../util";
const songMap = {};
for (const game of allSupportedGames) {
const songs = ReadCollection(`songs-${game}.json`);
songMap[game] = Object.fromEntries(songs.map((e) => [e.id, e]));
}
const songFormat = (s) => `${s.artist} - ${s.title} (${s.id})`;
const chartFormat = (s) => `${s.id} - ${s.playtype} ${s.difficulty} (${s.chartID})`;
const chartFormat = (s, game) =>
`${songMap[game][s.songID] ? songFormat(songMap[game][s.songID]) : s.songID} - ${s.playtype} ${
s.difficulty
} (${s.chartID})`;
export const FormatFunctions: Partial<Record<keyof typeof SCHEMAS, (d) => string>> = {
export const FormatFunctions: Partial<
Record<keyof typeof SCHEMAS, (d: any, g: Game | null) => string>
> = {
"bms-course-lookup": (d) => d.title,
folders: (d) => d.title,
tables: (d) => d.name,
"songs-bms": songFormat,
"songs-chunithm": songFormat,
"songs-iidx": songFormat,
@@ -18,6 +35,8 @@ export const FormatFunctions: Partial<Record<keyof typeof SCHEMAS, (d) => string
"songs-sdvx": songFormat,
"songs-usc": songFormat,
"songs-wacca": songFormat,
"songs-itg": songFormat,
"charts-bms": chartFormat,
"charts-chunithm": chartFormat,
"charts-iidx": chartFormat,
@@ -29,4 +48,5 @@ export const FormatFunctions: Partial<Record<keyof typeof SCHEMAS, (d) => string
"charts-sdvx": chartFormat,
"charts-usc": chartFormat,
"charts-wacca": chartFormat,
"charts-itg": chartFormat,
};