diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-02-28 01:07:48 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-02-28 01:07:48 -0800 |
| commit | 5d26d7a3f0571444f7a006b0c1be0c2bfe9912c5 (patch) | |
| tree | d7ce0fcef25653c30800e2eea87aa015f0b4a7a0 | |
| parent | 44c02c686561e06c572c45e31639d64b992f63d1 (diff) | |
sdvx: add merge sdvx csv script
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | sdvx/eamuse_csv/README.md | 18 | ||||
| -rw-r--r-- | sdvx/eamuse_csv/eamuse_merge_csv.py | 34 | ||||
| -rw-r--r-- | sdvx/eamuse_csv/sdvx_csv_to_tachi.py (renamed from sdvx/sdvx_csv_to_tachi.py) | 0 |
5 files changed, 55 insertions, 1 deletions
@@ -171,4 +171,5 @@ cython_debug/ .ruff_cache/ # PyPI configuration file -.pypirc
\ No newline at end of file +.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. diff --git a/sdvx/eamuse_csv/README.md b/sdvx/eamuse_csv/README.md new file mode 100644 index 0000000..7f9d8b3 --- /dev/null +++ b/sdvx/eamuse_csv/README.md @@ -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! diff --git a/sdvx/eamuse_csv/eamuse_merge_csv.py b/sdvx/eamuse_csv/eamuse_merge_csv.py new file mode 100644 index 0000000..490114e --- /dev/null +++ b/sdvx/eamuse_csv/eamuse_merge_csv.py @@ -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) diff --git a/sdvx/sdvx_csv_to_tachi.py b/sdvx/eamuse_csv/sdvx_csv_to_tachi.py index 5c18a73..5c18a73 100644 --- a/sdvx/sdvx_csv_to_tachi.py +++ b/sdvx/eamuse_csv/sdvx_csv_to_tachi.py |
