mirror of
https://github.com/HamletDuFromage/switch-cheats-db.git
synced 2025-04-24 08:25:17 +00:00
add cheats count
This commit is contained in:
parent
3c1f58729f
commit
be93ec6baa
@ -15,3 +15,5 @@ https://github.com/HamletDuFromage/switch-cheats-db/releases/latest
|
||||
| Gameplay codes | contents.zip | titles.zip |
|
||||
| Graphics codes | contents_60fps-res-gfx.zip | titles_60fps-res-gfx.zip |
|
||||
| Gameplay + graphics codes | contents_complete.zip | titles_complete.zip |
|
||||
|
||||
53330 cheats in 2383 titles/5389 updates
|
@ -133,6 +133,25 @@ class ArchiveWorker():
|
||||
with open(f"{out_path}/VERSION", "w") as version_file:
|
||||
version_file.write(str(date.today()))
|
||||
|
||||
def count_cheats(cheats_directory):
|
||||
n_games = 0
|
||||
n_updates = 0
|
||||
n_cheats = 0
|
||||
for json_file in Path(cheats_directory).glob('*.json'):
|
||||
with open(json_file, 'r') as file:
|
||||
cheats = json.load(file)
|
||||
for bid in cheats.values():
|
||||
n_cheats += len(bid)
|
||||
n_updates += 1
|
||||
n_games += 1
|
||||
|
||||
readme_file = Path('README.md')
|
||||
with readme_file.open('r') as file:
|
||||
lines = file.readlines()
|
||||
lines[-1] = f"{n_cheats} cheats in {n_games} titles/{n_updates} updates"
|
||||
with readme_file.open('w') as file:
|
||||
file.writelines(lines)
|
||||
|
||||
if __name__ == '__main__':
|
||||
cheats_path = "cheats"
|
||||
cheats_gba_path = "cheats_gbatemp"
|
||||
@ -169,5 +188,7 @@ if __name__ == '__main__':
|
||||
|
||||
archive_worker.create_version_file()
|
||||
|
||||
count_cheats(cheats_path)
|
||||
|
||||
else:
|
||||
print("Everything is already up to date!")
|
||||
|
Loading…
x
Reference in New Issue
Block a user