diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-03-08 20:02:50 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-03-08 20:02:50 -0800 |
| commit | d607610e90738e1fc80973574fc10e5285da69ec (patch) | |
| tree | c30a864a308693047c35701b1c97f4aebe1cae51 /sdvx/eamuse_csv | |
| parent | 4e5dbd9230732d6be0bed05b8846da937fce374c (diff) | |
fix sdvx script PUC/UC check + attach timeplayed
Diffstat (limited to 'sdvx/eamuse_csv')
| -rw-r--r-- | sdvx/eamuse_csv/sdvx_csv_to_tachi.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sdvx/eamuse_csv/sdvx_csv_to_tachi.py b/sdvx/eamuse_csv/sdvx_csv_to_tachi.py index 5c18a73..e860f0b 100644 --- a/sdvx/eamuse_csv/sdvx_csv_to_tachi.py +++ b/sdvx/eamuse_csv/sdvx_csv_to_tachi.py @@ -29,7 +29,7 @@ def convert_sdvx_csv_to_tachi_json(csv_file, game, playtype, service, unixtime): "meta": { "game": game, "playtype": playtype, - "service": service + "service": service, }, "scores": [] } @@ -44,9 +44,9 @@ def convert_sdvx_csv_to_tachi_json(csv_file, game, playtype, service, unixtime): for row in reader: lamp = LAMP_MAPPING[row["クリアランク"].upper()] - if row.get("ULTIMATE CHAIN"): + if row.get("ULTIMATE CHAIN") == "1": lamp = "ULTIMATE CHAIN" - if row.get("PERFECT"): + if row.get("PERFECT") == "1": lamp = "PERFECT ULTIMATE CHAIN" score_entry = { @@ -55,6 +55,7 @@ def convert_sdvx_csv_to_tachi_json(csv_file, game, playtype, service, unixtime): "matchType": "songTitle", "identifier": row["楽曲名"], "difficulty": DIFFICULTY_MAPPING[row["難易度"].upper()], + "timeAchieved": unixtime } optional_fields = {} if row.get("EXスコア"): @@ -70,7 +71,6 @@ def convert_sdvx_csv_to_tachi_json(csv_file, game, playtype, service, unixtime): if unixtime: if unixtime == "now": unixtime = int(time.time())*1000 - optional_fields["timeAchieved"] = unixtime if optional_fields: score_entry["optional"] = optional_fields batch_manual["scores"].append(score_entry) @@ -97,9 +97,10 @@ if __name__ == "__main__": parser.add_argument("-o", "--output", help="Output filename", default="sdvx_tachi.json") parser.add_argument("-t", "--time", help="UNIX time (in milliseconds) that should be added to the scores. Input 'now' if you want to use current time. If no value is provided timeAchieved will not be added to the final JSON", default=None) args = parser.parse_args() + curr_time = int(time.time() * 1000) if (args.time == "now" or args.time is None) else args.time try: - output_json = convert_sdvx_csv_to_tachi_json(args.csv_filename, "sdvx", "Single", args.service) + output_json = convert_sdvx_csv_to_tachi_json(args.csv_filename, "sdvx", "Single", args.service, curr_time) with open(args.output, "w", encoding="utf-8") as json_file: json.dump(output_json, json_file, ensure_ascii=False, indent=4) |
