mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge pull request #2965 from corysolovewicz/patch-5
Update update_amiibo_tools_lua.py
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user