Skip to content

Commit

Permalink
Order games alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
AnimatedSwine37 committed Dec 5, 2022
1 parent 654ee2c commit 1eade9f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions generateGamesList.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
| --- | --- | --- | --- | --- |
"""

i = 1
numCheats = 0
tableItems = []

for title in os.listdir("titles"):
cheats = [file.removesuffix(".txt") for file in os.listdir(os.path.join("titles", title, "cheats"))]
Expand All @@ -35,12 +35,14 @@
versionsLinked = [f"[{version[0]}](titles/{title}/cheats/{version[1]}.txt)" for version in versions]

nameLink = urllib.parse.quote(f"titles/{title}/{name}.txt")
table += f"| {i} | [{name}]({nameLink}) | [{title}](titles/{title}) | {', '.join(cheatsLinked)} | {', '.join(versionsLinked)} | \n"
i += 1
tableItems.append(f"[{name}]({nameLink}) | [{title}](titles/{title}) | {', '.join(cheatsLinked)} | {', '.join(versionsLinked)} |")
numCheats += len(cheats)

table = table.replace("{numCheats}", str(numCheats))
table = table.replace("{numTitles}", str(i - 1))
table = table.replace("{numTitles}", str(len(tableItems)))

tableItems.sort()
table += "\n".join([f"| {i+1} | {item}" for i, item in enumerate(tableItems)])

if(os.path.exists("GAMES.md")):
existingGames = open("GAMES.md", "r", encoding="utf-16").read()
Expand Down

0 comments on commit 1eade9f

Please sign in to comment.