Skip to content

Commit

Permalink
🚚 Organize games into folders in output
Browse files Browse the repository at this point in the history
  • Loading branch information
DrgnFireYellow committed Aug 1, 2024
1 parent 5d19b43 commit f73dfc3
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def make_player(gamefile, system, htmlname, gamename):
player_content = template.read()
player_content = player_content.replace("$GAMEFILE", gamefile)
player_content = player_content.replace("$GAMENAME", gamename)
with open(f"output/{htmlname}.html", "w") as output:
os.makedirs(f"output/{system}", exist_ok=True)
with open(f"output/{system}/{htmlname}.html", "w") as output:
output.write(player_content)


Expand Down Expand Up @@ -129,7 +130,7 @@ def make_player(gamefile, system, htmlname, gamename):
)
else:
make_player(
f"games/{system}/{game}",
f"/games/{system}/{game}",
system,
os.path.splitext(game)[0],
gamedisplayname,
Expand Down Expand Up @@ -176,9 +177,9 @@ def make_player(gamefile, system, htmlname, gamename):
logging.info(f"Adding {game} to index")
gamelisttable.add_row(gamedisplayname, game, system)
if os.path.isfile(artworkpath):
indexcontents += f'<li><a href="{os.path.splitext(game)[0]}.html" class="text-light text-decoration-none name"><img src="{artworkpath}"><br>{gamedisplayname}</a><span class="badge bg-primary">{system}</span></li>\n'
indexcontents += f'<li><a href="{system}/{os.path.splitext(game)[0]}.html" class="text-light text-decoration-none name"><img src="{artworkpath}"><br>{gamedisplayname}</a><span class="badge bg-primary">{system}</span></li>\n'
continue
indexcontents += f'<li><a href="{os.path.splitext(game)[0]}.html" class="text-light text-decoration-none name">{gamedisplayname}</a><span class="badge bg-primary">{system}</span></li>\n'
indexcontents += f'<li><a href="{system}/{os.path.splitext(game)[0]}.html" class="text-light text-decoration-none name">{gamedisplayname}</a><span class="badge bg-primary">{system}</span></li>\n'

shutil.copytree("artwork", "output/artwork")
logging.info("Creating index.html")
Expand Down
2 changes: 1 addition & 1 deletion templates/flash.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<embed src="$GAMEFILE">
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/gamegear.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<div id="game"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/html5.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<iframe src="$GAMEFILE" width="640" height="480"></iframe>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/megadrive.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<div id="game"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/n64.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<div id="game"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/nds.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<div id="game"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/nes.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<div id="game"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/scratch.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<iframe src="https://turbowarp.org/$GAMEFILE/embed?settings-button&fullscreen-background=%23212529&addons=pause,gamepad,remove-curved-stage-border" width="499" height="416" allowtransparency="true" frameborder="0" scrolling="no" allowfullscreen></iframe>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/snes.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="style.css">
<a href="index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<a href="/index.html" class="btn btn-primary m-3"><i class="bi bi-arrow-left-short"></i> Go back</a>
<div class="container" style="width:640px;height:480px;max-width:100%">
<div id="game"></div>
</div>
Expand Down

0 comments on commit f73dfc3

Please sign in to comment.