mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-12 17:28:31 +03:00
Merge pull request #737 from TNG-dev/zkldi/issue-736
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@
|
||||
"safe-json-stringify": "1.2.0",
|
||||
"semver": "^7.3.7",
|
||||
"seq-logging": "1.1.1",
|
||||
"tachi-common": "0.14.9",
|
||||
"tachi-common": "0.14.15",
|
||||
"ts-node": "10.4.0",
|
||||
"tsconfig-paths": "3.12.0",
|
||||
"typescript": "4.5.5",
|
||||
|
||||
Generated
+4
-4
@@ -68,7 +68,7 @@ specifiers:
|
||||
semver: ^7.3.7
|
||||
seq-logging: 1.1.1
|
||||
supertest: 6.2.2
|
||||
tachi-common: 0.14.9
|
||||
tachi-common: 0.14.15
|
||||
tap: 15.1.6
|
||||
ts-node: 10.4.0
|
||||
tsconfig-paths: 3.12.0
|
||||
@@ -117,7 +117,7 @@ dependencies:
|
||||
safe-json-stringify: 1.2.0
|
||||
semver: 7.3.7
|
||||
seq-logging: 1.1.1
|
||||
tachi-common: 0.14.9
|
||||
tachi-common: 0.14.15
|
||||
ts-node: 10.4.0_2615db9039ce432b4abf2fc39ef336ec
|
||||
tsconfig-paths: 3.12.0
|
||||
typescript: 4.5.5
|
||||
@@ -5452,8 +5452,8 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dev: true
|
||||
|
||||
/tachi-common/0.14.9:
|
||||
resolution: {integrity: sha512-jW5jNUAIPhTlJUhS69MHirBApP459CTHRFLr2wdetzcLvSf2KPyJjRST3tR9vjRMfu5s9Pvep6AIH+rpHqHK6w==}
|
||||
/tachi-common/0.14.15:
|
||||
resolution: {integrity: sha512-lK7jUhfJUAZ8cpukKrZxEO1Cvrn0wwr5YOaHDWlAkvdwFCN4hdf2g+R9SatgDdncAa/uk5angIXkuEdvhJ2Q1g==}
|
||||
dependencies:
|
||||
'@types/express-serve-static-core': 4.17.28
|
||||
'@types/mongodb': 3.6.18
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { PullDatabaseSeeds } from "lib/database-seeds/repo";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import fetch from "node-fetch";
|
||||
import type { ChartDocument } from "tachi-common";
|
||||
|
||||
const AI_URL = "https://bms.hexlataia.xyz/tables/json/ai.json";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
interface AITableEntry {
|
||||
level: string;
|
||||
md5: string;
|
||||
}
|
||||
|
||||
export async function UpdateAILevels() {
|
||||
const data = (await fetch(AI_URL).then((r) => r.json())) as Array<AITableEntry>;
|
||||
|
||||
const map = Object.fromEntries(data.map((e) => [e.md5, e.level]));
|
||||
|
||||
const repo = await PullDatabaseSeeds();
|
||||
|
||||
await repo.MutateCollection<ChartDocument<"bms:7K">>("charts-bms", (charts) => {
|
||||
for (const chart of charts) {
|
||||
chart.data.aiRating = map[chart.data.hashMD5] ?? null;
|
||||
}
|
||||
|
||||
return charts;
|
||||
});
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
UpdateAILevels()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err: unknown) => {
|
||||
logger.error(`Failed to sync BMS AI Table.`, { err }, () => {
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -295,21 +295,23 @@ export async function UpdateTable(table: BMSTablesDataset) {
|
||||
logger.info(`Levels bumped.`);
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
(async () => {
|
||||
for (const table of registeredTables) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await UpdateTable(table);
|
||||
}
|
||||
export async function SyncBMSTables() {
|
||||
for (const table of registeredTables) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await UpdateTable(table);
|
||||
}
|
||||
|
||||
logger.info(`Re-initialising folder-chart-lookup, since changes may have been made.`);
|
||||
await InitaliseFolderChartLookup();
|
||||
logger.info(`Done.`);
|
||||
logger.info(`Re-initialising folder-chart-lookup, since changes may have been made.`);
|
||||
await InitaliseFolderChartLookup();
|
||||
logger.info(`Done.`);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
})().catch((err: unknown) => {
|
||||
logger.error(`Failed to sync BMS Tables.`, { err }, () => {
|
||||
process.exit(1);
|
||||
if (require.main === module) {
|
||||
SyncBMSTables()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err: unknown) => {
|
||||
logger.error(`Failed to sync BMS Tables.`, { err }, () => {
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { BacksyncBMSPMSSongsAndCharts } from "../backsync-bms-pms-data";
|
||||
import { UpdateAILevels } from "../bms-ai-table-sync";
|
||||
import { SyncBMSTables } from "../bms-table-sync";
|
||||
import { DeoprhanScores } from "../deorphan-scores";
|
||||
import { UGSSnapshot } from "../ugs-snapshot";
|
||||
import { UpdatePoyashiData } from "../update-bpi-data";
|
||||
@@ -37,6 +39,7 @@ if (TachiConfig.TYPE !== "btchi") {
|
||||
cronFormat: "2 0 * * *",
|
||||
run: UpdatePoyashiData,
|
||||
});
|
||||
|
||||
jobs.push({
|
||||
name: "Update DP Tiers",
|
||||
cronFormat: "3 0 * * *",
|
||||
@@ -44,11 +47,23 @@ if (TachiConfig.TYPE !== "btchi") {
|
||||
});
|
||||
}
|
||||
|
||||
// if bokutachi or omnimitachi
|
||||
// if bokutachi or omnitachi
|
||||
if (TachiConfig.TYPE !== "ktchi") {
|
||||
jobs.push({
|
||||
name: "Backsync BMS + PMS",
|
||||
name: "Update AI Table",
|
||||
cronFormat: "2 0 * * *",
|
||||
run: UpdateAILevels,
|
||||
});
|
||||
|
||||
jobs.push({
|
||||
name: "Update Tables",
|
||||
cronFormat: "3 0 * * *",
|
||||
run: SyncBMSTables,
|
||||
});
|
||||
|
||||
jobs.push({
|
||||
name: "Backsync BMS + PMS",
|
||||
cronFormat: "4 0 * * *",
|
||||
run: BacksyncBMSPMSSongsAndCharts,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export function AssertStrAsDifficulty(
|
||||
): Difficulties[IDStrings] {
|
||||
const validDifficulties = GetGamePTConfig(game, playtype).difficulties;
|
||||
|
||||
if (!validDifficulties.includes(strVal as Difficulties[IDStrings])) {
|
||||
if (!validDifficulties.includes(strVal)) {
|
||||
throw new InvalidScoreFailure(
|
||||
`Invalid Difficulty for ${game} ${playtype} - Expected any of ${validDifficulties.join(
|
||||
", "
|
||||
@@ -17,7 +17,7 @@ export function AssertStrAsDifficulty(
|
||||
);
|
||||
}
|
||||
|
||||
return strVal as Difficulties[IDStrings];
|
||||
return strVal;
|
||||
}
|
||||
|
||||
const isIntegerRegex = /^-?\d+$/u;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"chartID": "88eb6cc5683e2740cbd07f588a5f3db1db8d467b",
|
||||
"rgcID": null,
|
||||
"data": {
|
||||
"aiRating": "0",
|
||||
"notecount": 2256,
|
||||
"hashMD5": "38616b85332037cc12924f2ae2840262",
|
||||
"hashSHA256": "195fe1be5c3e74fccd04dc426e05f8a9cfa8a1059c339d0a23e99f63661f0b7d",
|
||||
|
||||
@@ -321,6 +321,7 @@ export const BMSGazerChart: ChartDocument<"bms:7K"> = {
|
||||
chartID: "88eb6cc5683e2740cbd07f588a5f3db1db8d467b",
|
||||
rgcID: null,
|
||||
data: {
|
||||
aiRating: "0",
|
||||
notecount: 2256,
|
||||
hashMD5: "38616b85332037cc12924f2ae2840262",
|
||||
hashSHA256: "195fe1be5c3e74fccd04dc426e05f8a9cfa8a1059c339d0a23e99f63661f0b7d",
|
||||
|
||||
Reference in New Issue
Block a user