mirror of
https://gitea.tendokyu.moe/pinapelz/more-tachi-import-scripts.git
synced 2026-09-22 22:28:25 +03:00
sdvx: add merge sdvx csv script
This commit is contained in:
+2
-1
@@ -171,4 +171,5 @@ cython_debug/
|
||||
.ruff_cache/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
.pypirc
|
||||
.csv
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# more-tachi-import-scripts
|
||||
Some scripts to convert from various sources to Tachi/Kamaitachi "Batch Manual" import jsons.
|
||||
Use with caution as there may be some cases missing.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# e-amusement SDVX CSV to Tachi WARNING!!!
|
||||
The CSV provided by Konami doesn't contain any information regarding the date which you played/obtained a particular score. It only keeps your BEST score.
|
||||
|
||||
This causes for duplicate imports if you use this script more than once
|
||||
|
||||
## Solution
|
||||
The first time you import, run `sdvx_csv_to_tach.py` and import the output JSON file normally. Howver **KEEP THE OLD CSV FILE**
|
||||
|
||||
The next time you play, export the CSV again but first run `eamuse_merge_csv.py --old <file> --new <file>`. Passing the old and new CSV files accordingly.
|
||||
|
||||
This will check for differences between the 2 files and remove lines of the same value in the new file so that only newly obtained best scores are uploaded.
|
||||
|
||||
# What if I want all plays?
|
||||
I don't think there's a method right now to automatically import arcade data into Tachi for each play. Play history is locked behind the eAmusement basic subscription plan.
|
||||
|
||||
The best you can do is download the eAmusement app, subscribe the the basic course and manually make your own score CSV in the same format. Then run `sdvx_csv_to_tach.py`
|
||||
|
||||
Alternatively, you can take pictures of each play result screen and build your own JSON so that there is even more info available!
|
||||
@@ -0,0 +1,34 @@
|
||||
import argparse
|
||||
import csv
|
||||
|
||||
def merge_csv(old_file: str, new_file: str):
|
||||
old_csv_set = set()
|
||||
new_csv_set = set()
|
||||
encoding = "utf-8"
|
||||
with open(old_file, encoding=encoding) as old_csv:
|
||||
reader = csv.reader(old_csv, delimiter=",")
|
||||
[old_csv_set.add(tuple(row)) for row in reader]
|
||||
with open(new_file, "r", encoding=encoding) as new_csv:
|
||||
reader = csv.reader(new_csv, delimiter=",")
|
||||
header = next(reader)
|
||||
[new_csv_set.add(tuple(row)) for row in reader]
|
||||
new_csv_set = new_csv_set - old_csv_set
|
||||
|
||||
with open(new_file, "w", encoding=encoding, newline="") as new_csv:
|
||||
writer = csv.writer(new_csv, delimiter=",")
|
||||
writer.writerow(header)
|
||||
for row in new_csv_set:
|
||||
if row == ():
|
||||
continue
|
||||
writer.writerow(list(row))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="eamuse_merge_to_csv",
|
||||
description="Merges an old SDVX e-amuse CSV with a new one. Keeping only new scores in the new file",
|
||||
)
|
||||
parser.add_argument("--old", help="Old CSV file", required=True)
|
||||
parser.add_argument("--new", help="New CSV file", required=True)
|
||||
args = parser.parse_args()
|
||||
merge_csv(args.old, args.new)
|
||||
Reference in New Issue
Block a user