mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 10:58:07 +03:00
@@ -13,3 +13,6 @@ coverage
|
||||
scripts/arc-db-sync/charts.json
|
||||
scripts/arc-db-sync/songs.json
|
||||
scripts/validate-database-errs/*
|
||||
|
||||
scripts/parse-beatoraja-mdb/*
|
||||
!scripts/parse-beatoraja-mdb/main.ts
|
||||
@@ -0,0 +1,85 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// @ts-nocheck
|
||||
// yeah, this script is old and wrote in JS. what of it.
|
||||
const sqlDB = require("better-sqlite3")("songdata.db");
|
||||
const fs = require("fs");
|
||||
|
||||
console.log("Connecting to database...");
|
||||
console.time("DB CONNECT TIME");
|
||||
const crypto = require("crypto");
|
||||
|
||||
const ktchiSongs = [];
|
||||
const ktchiCharts = [];
|
||||
|
||||
const stmt = sqlDB.prepare("SELECT * FROM song");
|
||||
|
||||
let freeSongID = 1;
|
||||
|
||||
const DIFFICULTY_LOOKUP = ["CUSTOM", "BEGINNER", "NORMAL", "HYPER", "ANOTHER", "CUSTOM"];
|
||||
|
||||
const PLAYTYPE_LOOKUP = {
|
||||
7: "7K",
|
||||
14: "14K",
|
||||
5: "5K",
|
||||
10: "10K",
|
||||
};
|
||||
|
||||
for (const song of stmt.iterate()) {
|
||||
const playtype = PLAYTYPE_LOOKUP[song.mode.toString()];
|
||||
|
||||
const songID = freeSongID;
|
||||
const chartID = crypto.randomBytes(20).toString("hex");
|
||||
|
||||
let difficulty = DIFFICULTY_LOOKUP[song.difficulty];
|
||||
|
||||
freeSongID++;
|
||||
|
||||
if (!difficulty) {
|
||||
console.log(song.difficulty);
|
||||
difficulty = "CUSTOM"; // fuck it and fuck you, you bitch.
|
||||
}
|
||||
|
||||
const ktchiChart = {
|
||||
songID,
|
||||
chartID: chartID,
|
||||
rgcID: null,
|
||||
data: {
|
||||
notecount: song.notes,
|
||||
hashMD5: song.md5,
|
||||
hashSHA256: song.sha256,
|
||||
},
|
||||
level: "?",
|
||||
levelNum: 0,
|
||||
difficulty,
|
||||
playtype,
|
||||
isPrimary: true,
|
||||
versions: [],
|
||||
};
|
||||
|
||||
const ktchiSong = {
|
||||
id: songID,
|
||||
title: song.title,
|
||||
artist: song.artist,
|
||||
firstVersion: null,
|
||||
data: {
|
||||
subtitle: song.subtitle ?? null,
|
||||
subartist: song.subartist ?? null,
|
||||
genre: song.genre ?? null,
|
||||
},
|
||||
"search-titles": [],
|
||||
"alt-titles": [],
|
||||
};
|
||||
|
||||
ktchiSongs.push(ktchiSong);
|
||||
ktchiCharts.push(ktchiChart);
|
||||
}
|
||||
|
||||
console.log("done");
|
||||
|
||||
fs.writeFileSync("songs.json", JSON.stringify(ktchiSongs));
|
||||
fs.writeFileSync("charts.json", JSON.stringify(ktchiCharts));
|
||||
|
||||
console.log("postwrite");
|
||||
Reference in New Issue
Block a user