Add play button

This commit is contained in:
Timothy Farrell 2026-03-17 21:16:54 -05:00
parent 4c786fbce9
commit 78fd988583
2 changed files with 19 additions and 2 deletions

View File

@ -38,6 +38,18 @@
.chevron:hover { color: rgba(255, 255, 255, 0.9); }
.chevron.left { left: 10px; }
.chevron.right { right: 10px; }
.play-btn {
position: fixed;
bottom: 20px;
right: 20px;
font-size: 48px;
color: rgba(255, 255, 255, 0.7);
cursor: pointer;
text-decoration: none;
transition: color 0.2s, transform 0.2s;
padding: 10px;
}
.play-btn:hover { color: rgba(255, 255, 255, 1); transform: scale(1.1); }
</style>
</head>
<body>
@ -45,6 +57,7 @@
<a href="$image_click_url"><img id="img" src="$img_url" title="$filename"></a>
<a href="$prev_url" class="chevron left" id="prev-btn">&#8249;</a>
<a href="$next_url" class="chevron right" id="next-btn">&#8250;</a>
$play_button
</div>
<script>
function getRefreshParams() {

View File

@ -187,7 +187,7 @@ def _get_navigation_data(file_hash: str):
def _render_page(
navigation_data: dict, extra_meta: str = "", image_click_url: str = ""
navigation_data: dict, extra_meta: str = "", image_click_url: str = "", play_button: str = ""
) -> HTMLResponse:
"""Render the frontend page with navigation data"""
with open("frontend.html", "r") as f:
@ -202,6 +202,7 @@ def _render_page(
prev_url="/{prev_hash}".format(prev_hash=navigation_data["prev_hash"]),
filename=navigation_data["filename"],
extra_meta=extra_meta,
play_button=play_button,
)
return HTMLResponse(content=content)
@ -214,7 +215,10 @@ async def hash_page(file_hash: str):
raise HTTPException(status_code=404, detail="File not found")
navigation_data = _get_navigation_data(file_hash)
return _render_page(navigation_data)
play_button = '<a href="/next/5/{file_hash}" class="play-btn" title="Play next 5">▶</a>'.format(
file_hash=file_hash
)
return _render_page(navigation_data, play_button=play_button)
@app.get("/{order}/{delay}/{file_hash}")