1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
import argparse
import json
import os
LAMP_MAP = {
1: "FAILED",
3: "CLEARED"
}
SEQUENCE_MAP = {
0: "BSC",
1: "ADV",
2: "EXT"
}
def convert_from_czeave_json_to_tachi_json(file: str, output_path: str, service: str, profile_id: str):
with open(file, "r", encoding="utf-8") as infile:
batch_manual = {
"meta": {"game": "jubeat", "playtype": "Single", "service": service},
}
scores = []
data = [json.loads(line) for line in infile if '"collection":"score"' in line and profile_id in line]
for score in data:
difficulty = SEQUENCE_MAP[score["seq"]]
if score["isHardMode"]:
difficulty = "HARD " + difficulty
lamp = "FAILED"
if score["clearCount"] >= 1:
lamp = "CLEAR"
if score["fullcomboCount"] >= 1:
lamp = "FULL COMBO"
if score["excellentCount"] >= 1:
lamp = "EXCELLENT"
timestamp = score["updatedAt"]["$$date"]
music_rate = score["musicRate"] / 10
curr_score = {
"matchType": "inGameID",
"identifier": str(score["musicId"]),
"difficulty": difficulty,
"score": score["score"],
"lamp": lamp,
"timeAchieved": timestamp,
"musicRate": music_rate,
}
scores.append(curr_score)
batch_manual["scores"] = scores
with open(output_path, "w", encoding="utf-8") as outfile:
json.dump(batch_manual, outfile, indent=4, ensure_ascii=False)
print(f"Output saved to {output_path}")
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog="czeave_to_tachi.py",
description="Converts czeave Asphyxia Jubeat save data to Tachi compatible JSON",
)
parser.add_argument(
"-s",
"--service",
help="Service description to be shown on Tachi (Note for where this score came from)",
default="jubeat Asphyxia CZEAve",
)
parser.add_argument("-f", "--file", help="AsphyxiaCORE jubeat .db file (jubeat@asphyxia.db)", required=True)
parser.add_argument(
"-o", "--output", help="Output filename", default="czeave_asphyxia_batch_manual.json"
)
parser.add_argument("-p", "--profile", help="Asphyxia Profile ID to export for")
args = parser.parse_args()
if args.file is None:
print("ERROR: Please specify Asphyxia DB file (from savedata folder)")
exit(1)
if not os.path.exists(args.file):
print(f"ERROR: The file {args.file} does not exist.")
exit(1)
convert_from_czeave_json_to_tachi_json(args.file, args.output, args.service, args.profile)
|