forked from sk1982/actaeon
chuni: import note counts and chart credits
This commit is contained in:
parent
63539b22e5
commit
6d5661c1f3
@ -5,6 +5,7 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/scripts/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
7
.idea/misc.xml
Normal file
7
.idea/misc.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (actaeon)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (actaeon)" project-jdk-type="Python SDK" />
|
||||
</project>
|
53
migrations/20240413060445-create-chuni-static-music-ext.js
Normal file
53
migrations/20240413060445-create-chuni-static-music-ext.js
Normal file
@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var dbm;
|
||||
var type;
|
||||
var seed;
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var Promise;
|
||||
|
||||
/**
|
||||
* We receive the dbmigrate dependency from dbmigrate initially.
|
||||
* This enables us to not have to rely on NODE_PATH.
|
||||
*/
|
||||
exports.setup = function(options, seedLink) {
|
||||
dbm = options.dbmigrate;
|
||||
type = dbm.dataType;
|
||||
seed = seedLink;
|
||||
Promise = options.Promise;
|
||||
};
|
||||
|
||||
exports.up = function(db) {
|
||||
var filePath = path.join(__dirname, 'sqls', '20240413060445-create-chuni-static-music-ext-up.sql');
|
||||
return new Promise( function( resolve, reject ) {
|
||||
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
||||
if (err) return reject(err);
|
||||
console.log('received data: ' + data);
|
||||
|
||||
resolve(data);
|
||||
});
|
||||
})
|
||||
.then(function(data) {
|
||||
return db.runSql(data);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(db) {
|
||||
var filePath = path.join(__dirname, 'sqls', '20240413060445-create-chuni-static-music-ext-down.sql');
|
||||
return new Promise( function( resolve, reject ) {
|
||||
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
||||
if (err) return reject(err);
|
||||
console.log('received data: ' + data);
|
||||
|
||||
resolve(data);
|
||||
});
|
||||
})
|
||||
.then(function(data) {
|
||||
return db.runSql(data);
|
||||
});
|
||||
};
|
||||
|
||||
exports._meta = {
|
||||
"version": 1
|
||||
};
|
@ -0,0 +1 @@
|
||||
DROP TABLE actaeon_chuni_static_music_ext;
|
@ -0,0 +1,14 @@
|
||||
CREATE TABLE actaeon_chuni_static_music_ext (
|
||||
songId INT NOT NULL,
|
||||
chartId INT NOT NULL,
|
||||
|
||||
chartDesigner VARCHAR(255),
|
||||
tapJudgeCount INT NOT NULL,
|
||||
holdJudgeCount INT NOT NULL,
|
||||
slideJudgeCount INT NOT NULL,
|
||||
airJudgeCount INT NOT NULL,
|
||||
flickJudgeCount INT NOT NULL,
|
||||
allJudgeCount INT NOT NULL,
|
||||
|
||||
PRIMARY KEY (songId, chartId)
|
||||
);
|
@ -63,11 +63,36 @@ class Chuni(Importer):
|
||||
self.get_xml('trophy', 'Trophy', ('./name/id', int), './name/str', ('./rareType', int), './explainText')
|
||||
)
|
||||
|
||||
def import_charts(self):
|
||||
inserts = []
|
||||
for file in chain(self.data_dir.glob(f'A000/music/*/*.c2s'),
|
||||
self.opt_dir.glob(f'*/music/*/*.c2s')):
|
||||
print(file)
|
||||
data = {}
|
||||
song, chart = map(int, file.stem.split('_'))
|
||||
if song >= 8000: chart = 5
|
||||
with open(file, 'r', encoding='utf8') as f:
|
||||
for line in f.readlines():
|
||||
parts = line.strip().split('\t')
|
||||
if len(parts) == 2:
|
||||
data[parts[0]] = parts[1]
|
||||
inserts.append((song, chart, data['CREATOR'], data['T_JUDGE_TAP'], data['T_JUDGE_HLD'], data['T_JUDGE_SLD'],
|
||||
data['T_JUDGE_AIR'], data['T_JUDGE_FLK'], data['T_JUDGE_ALL']))
|
||||
fields = ['songId', 'chartId', 'chartDesigner', 'tapJudgeCount', 'holdJudgeCount', 'slideJudgeCount',
|
||||
'airJudgeCount', 'flickJudgeCount', 'allJudgeCount']
|
||||
self.cur.executemany(
|
||||
f'''INSERT INTO actaeon_chuni_static_music_ext({','.join(fields)})
|
||||
VALUES ({','.join(['%s'] * len(fields))})
|
||||
ON DUPLICATE KEY UPDATE {','.join(f"{f}={f}" for f in fields)}''',
|
||||
inserts
|
||||
)
|
||||
|
||||
def do_import(self):
|
||||
self.import_map_icon()
|
||||
self.import_name_plate()
|
||||
self.import_system_voice()
|
||||
self.import_trophies()
|
||||
self.import_charts()
|
||||
|
||||
@staticmethod
|
||||
def register(parser):
|
||||
|
Loading…
Reference in New Issue
Block a user