Skip to content

Commit

Permalink
Fix bug causing image link in readme to lead to the wrong address and…
Browse files Browse the repository at this point in the history
… add a sort to the table
  • Loading branch information
Flyingbacen authored Nov 24, 2024
1 parent 3abccf2 commit 8929997
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/games-list-autocreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def findLowQualityIcons():
print(f"non-square icon found for game: {game['titlename']}: {width}x{height}")
non_square_icons.append(game["titlename"])

games = "| --- | --- | --- |\n"
games = ""
for game in games_list["Games List"][0]["Games"]:
if game["titlename"] in ["UpdateCheck", "BroadcastObj"]:
continue
Expand All @@ -82,9 +82,20 @@ def findLowQualityIcons():
game["titlename"] in low_quality_icons or
game["titlename"] in non_square_icons
) else "✔"
games = games + f"| {game['titlename'].replace('\\', '\\\\').replace('|', '\\|').replace('*', '\\*').replace('_', '\\_').replace('~', '\\~').replace('`', '\\`').replace('#', '\\#')} | [Image link]({game['titleicon'].replace(' ', '%20').replace('\\', '\\\\').replace('|', '\\|').replace('*', '\\*').replace('_', '\\_').replace('~', '\\~').replace('`', '\\`').replace('#', '\\#')}) | {status} |\n"
games = games + f"| {game['titlename'].replace('\\', '\\\\').replace('|', '\\|').replace('*', '\\*').replace('_', '\\_').replace('~', '\\~').replace('`', '\\`').replace('#', '\\#')} | [Image link]({game['titleicon'].replace(' ', '%20')}) | {status} |\n"

results=f"| Game Title | Link | Status |\n{games}"
def key(line):
if '❌' in line:
return 0
elif '❓' in line:
return 1
else:
return 2

sorted_lines = "\n".join(sorted(games.split("\n"), key=key))


results=f"| Game Title | Link | Status |\n| --- | --- | --- |\n{sorted_lines}"

with open(fileToWrite, "w", encoding="utf-8", newline="\n") as file:
file.write(results)
Expand Down

0 comments on commit 8929997

Please sign in to comment.