mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-10 16:28:17 +03:00
update wacca script to use better datasource, add new charts
This commit is contained in:
@@ -2090,6 +2090,23 @@
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "cc384f7ac347b46d1b046851c11db6a65476311a",
|
||||
"data": {
|
||||
"isHot": true
|
||||
},
|
||||
"difficulty": "INFERNO",
|
||||
"isPrimary": true,
|
||||
"level": "14",
|
||||
"levelNum": 14,
|
||||
"playtype": "Single",
|
||||
"rgcID": null,
|
||||
"songID": 40,
|
||||
"tierlistInfo": {},
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "1aaf04c98b8a276e38acba1645ef04fd0288d94a",
|
||||
"data": {
|
||||
@@ -15129,6 +15146,23 @@
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "bb12f97e462971858fd9960c020c31d1bf15d27e",
|
||||
"data": {
|
||||
"isHot": true
|
||||
},
|
||||
"difficulty": "INFERNO",
|
||||
"isPrimary": true,
|
||||
"level": "14",
|
||||
"levelNum": 14.1,
|
||||
"playtype": "Single",
|
||||
"rgcID": null,
|
||||
"songID": 293,
|
||||
"tierlistInfo": {},
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "6997c63907fd1f49cf5b24992fe5b356d72d9270",
|
||||
"data": {
|
||||
@@ -18341,5 +18375,73 @@
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "5443c455fc0088c2f274cd718016bf0aa3fab697",
|
||||
"data": {
|
||||
"isHot": true
|
||||
},
|
||||
"difficulty": "EXPERT",
|
||||
"isPrimary": true,
|
||||
"level": "13+",
|
||||
"levelNum": 13.7,
|
||||
"playtype": "Single",
|
||||
"rgcID": null,
|
||||
"songID": 354,
|
||||
"tierlistInfo": {},
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "c6e2513a32200f34871478d4d0739291c5f852cd",
|
||||
"data": {
|
||||
"isHot": true
|
||||
},
|
||||
"difficulty": "HARD",
|
||||
"isPrimary": true,
|
||||
"level": "10+",
|
||||
"levelNum": 10.9,
|
||||
"playtype": "Single",
|
||||
"rgcID": null,
|
||||
"songID": 354,
|
||||
"tierlistInfo": {},
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "60517ead875ef3d3a42c600ef78a4c0841a633e5",
|
||||
"data": {
|
||||
"isHot": true
|
||||
},
|
||||
"difficulty": "INFERNO",
|
||||
"isPrimary": true,
|
||||
"level": "14",
|
||||
"levelNum": 14.1,
|
||||
"playtype": "Single",
|
||||
"rgcID": null,
|
||||
"songID": 354,
|
||||
"tierlistInfo": {},
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"chartID": "47c66e40c4a2b8393f805a403990c3245d084d83",
|
||||
"data": {
|
||||
"isHot": true
|
||||
},
|
||||
"difficulty": "NORMAL",
|
||||
"isPrimary": true,
|
||||
"level": "6",
|
||||
"levelNum": 6,
|
||||
"playtype": "Single",
|
||||
"rgcID": null,
|
||||
"songID": 354,
|
||||
"tierlistInfo": {},
|
||||
"versions": [
|
||||
"reverse"
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
+40
-33
@@ -1,4 +1,3 @@
|
||||
const { parse } = require("csv-parse/sync");
|
||||
const fs = require("fs");
|
||||
const fetch = require("node-fetch");
|
||||
const { Command } = require("commander");
|
||||
@@ -8,31 +7,35 @@ const logger = require("../logger");
|
||||
|
||||
const program = new Command();
|
||||
|
||||
// https://github.com/shimmand/waccaSupportTools/blob/main/analyzePlayData/chartsTable.csv
|
||||
program.option("-f, --file <wacca.csv>");
|
||||
// https://github.com/shimmand/waccaSupportTools/blob/main/analyzePlayData/rating-dataset.js
|
||||
// Please look at the file before running, it is eval'd and can execute arbitrary code.
|
||||
program.requiredOption("-r, --rating-js <rating-dataset.js>");
|
||||
|
||||
program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
|
||||
if (!options.file) {
|
||||
throw new Error("No wacca.csv provided.");
|
||||
}
|
||||
|
||||
const dirtyRecords = parse(fs.readFileSync(options.file), {});
|
||||
const dirtyRecords = Function(
|
||||
'"use strict";' +
|
||||
// Should define functions getChartTable and getLastUpdate.
|
||||
fs.readFileSync(options.ratingJs).toString() +
|
||||
'return getChartTable()'
|
||||
)();
|
||||
|
||||
// 0-song-title
|
||||
// 1-normal-level
|
||||
// 2-normal-const
|
||||
// 3-normal-is-newer
|
||||
// 4-hard-level
|
||||
// 5-hard-const
|
||||
// 6-hard-is-newer
|
||||
// 7-expert-level
|
||||
// 8-expert-const
|
||||
// 9-expert-is-newer
|
||||
// 10-inferno-level
|
||||
// 11-inferno-const
|
||||
// 12-inferno-is-newer
|
||||
// 1-song-title-eng
|
||||
// 2-genre-name
|
||||
// 3-normal-level
|
||||
// 4-normal-const
|
||||
// 5-normal-is-newer
|
||||
// 6-hard-level
|
||||
// 7-hard-const
|
||||
// 8-hard-is-newer
|
||||
// 9-expert-level
|
||||
// 10-expert-const
|
||||
// 11-expert-is-newer
|
||||
// 12-inferno-level
|
||||
// 13-inferno-const
|
||||
// 14-inferno-is-newer
|
||||
|
||||
const dataMap = new Map();
|
||||
|
||||
@@ -42,7 +45,7 @@ const titleMap = {
|
||||
};
|
||||
|
||||
// Converts the title on the site to a noramlized version that we
|
||||
// can match against the CSV.
|
||||
// can match against the dataset.
|
||||
function siteTitleNormalize(siteTitle) {
|
||||
let normalized = decode(siteTitle.replace(/ /g, " ")).trim();
|
||||
|
||||
@@ -53,17 +56,16 @@ function siteTitleNormalize(siteTitle) {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
// Note that the title in the CSV is the one we want - it's what's
|
||||
// Note that the title in the dataset is the one we want - it's what's
|
||||
// used on the actual site. However, this normalizes it so we can
|
||||
// match against the broken titles on the music search site.
|
||||
function csvTitleNormalize(csvTitle) {
|
||||
return csvTitle.replace(/”|“/gu, '"').replace(/’/gu, "'");
|
||||
function datasetTitleNormalize(datasetTitle) {
|
||||
return datasetTitle.replace(/”|“/gu, '"').replace(/’/gu, "'");
|
||||
}
|
||||
|
||||
// we have to skip the first record because its the headers,
|
||||
// and there's literally no way to change this behaviour.
|
||||
// We have to skip the first record because its the headers.
|
||||
for (const record of dirtyRecords.slice(1)) {
|
||||
dataMap.set(csvTitleNormalize(record[0]), record);
|
||||
dataMap.set(datasetTitleNormalize(record[0]), record);
|
||||
}
|
||||
|
||||
const STARTS = {
|
||||
@@ -131,7 +133,7 @@ const STARTS = {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Use the CSV title.
|
||||
// Use the dataset title.
|
||||
const title = record[0];
|
||||
const siteTitle = decode(data.title.display).trim();
|
||||
const altTitles = [];
|
||||
@@ -139,6 +141,11 @@ const STARTS = {
|
||||
// Include the title on the music site just in case.
|
||||
altTitles.push(siteTitle);
|
||||
}
|
||||
const searchTerms = [];
|
||||
if (record[1] !== "") {
|
||||
// This is the english title.
|
||||
searchTerms.push(record[1]);
|
||||
}
|
||||
|
||||
let thisSongID = songID;
|
||||
if (existingSongs.has(title)) {
|
||||
@@ -150,7 +157,7 @@ const STARTS = {
|
||||
id: thisSongID,
|
||||
title,
|
||||
artist: decode(data.artist.display).trim(),
|
||||
searchTerms: [],
|
||||
searchTerms,
|
||||
altTitles,
|
||||
data: {
|
||||
titleJP: decode(data.title.ruby),
|
||||
@@ -161,10 +168,10 @@ const STARTS = {
|
||||
});
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const diff = record[1 + i * 3];
|
||||
const diff = record[3 + i * 3];
|
||||
const [diffName, level] = diff.split(" ");
|
||||
const levelNum = Number(record[2 + i * 3]);
|
||||
const isNew = record[3 + i * 3];
|
||||
const levelNum = record[4 + i * 3];
|
||||
const isNew = record[5 + i * 3];
|
||||
|
||||
if (!levelNum) {
|
||||
continue;
|
||||
@@ -182,7 +189,7 @@ const STARTS = {
|
||||
difficulty: diffName,
|
||||
playtype: "Single",
|
||||
data: {
|
||||
isHot: isNew === "true",
|
||||
isHot: isNew,
|
||||
},
|
||||
tierlistInfo: {},
|
||||
versions: ["reverse"],
|
||||
Reference in New Issue
Block a user