From 4455d28e6a4504ae6418a38cb2d5921677193a33 Mon Sep 17 00:00:00 2001 From: Cory Solovewicz Date: Sat, 30 Aug 2025 21:59:16 -0700 Subject: [PATCH] Update update_amiibo_tools_lua.py Updated with quality of life improvements to make things more clear in the output. Signed-off-by: Cory Solovewicz --- client/update_amiibo_tools_lua.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/update_amiibo_tools_lua.py b/client/update_amiibo_tools_lua.py index 8a31b9d60..b28fc99c8 100644 --- a/client/update_amiibo_tools_lua.py +++ b/client/update_amiibo_tools_lua.py @@ -7,9 +7,9 @@ Name: update_amiibo_tools_lua.py Author: Cory Solovewicz Description: -This is a python script to automate what the updating of the amiibo_tools.lua +This is a python script to automate what the updating of the /lualibs/amiibo_tools.lua file which holds a lua table of all known amiibos. Previously updating the -amiibo_tools.lua was a very manual process. +amiibo_tools.lua was a very manual process. This script automates the following original command: curl https://raw.githubusercontent.com/N3evin/AmiiboAPI/master/database/amiibo.json | jq 'del(.amiibos[].release)' | jq 'del(.characters)' | pbcopy --> transform to table @@ -19,7 +19,7 @@ which can then be placed in the /lualibs/ directory. The temporary amiibo.json file is then deleted Dependencies: -python3 -m pip install jq +python -m pip install jq How to run: python update_amiibo_tools_lua.py @@ -79,7 +79,7 @@ def process_file(filename): data = re.sub('" =', '"] =', data) # Prepend the text - prepend_text = 'local amiibo_tools = {}\n\n-- curl https://raw.githubusercontent.com/N3evin/AmiiboAPI/master/database/amiibo.json | jq \'del(.amiibos[].release)\' | jq \'del(.characters)\' | pbcopy --> transform to table\namiibo_tools.db =\n' + prepend_text = '-- This file is auto-generated by /client/update_amiibo_tools_lua.py\n\nlocal amiibo_tools = {}\n\namiibo_tools.db =\n' data = prepend_text + data # Append the text @@ -93,6 +93,7 @@ def write_to_file(data, filename): with open(filename, 'w', encoding='utf-8') as file: file.write(data) print(f"Output written to {filename}") + print(f"Please backup the original /client/lualibs/amiibo_tools.lua and move the updated {filename} to the /client/lualibs/ directory.") def delete_file(filename): try: