Compare commits

...

2 Commits

Author SHA1 Message Date
94fed6db51 Add a pause button 2026-03-17 21:34:07 -05:00
78fd988583 Add play button 2026-03-17 21:16:54 -05:00
2 changed files with 25 additions and 3 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() {

15
main.py
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}")
@ -240,7 +244,12 @@ async def hash_page_with_refresh(order: str, delay: int, file_hash: str):
refresh_meta = f'<meta http-equiv="refresh" content="{delay};url={refresh_url}">'
image_click_url = "/{file_hash}".format(file_hash=file_hash)
return _render_page(navigation_data, refresh_meta, image_click_url)
# Create pause button to stop auto-refresh
pause_button = '<a href="/{file_hash}" class="play-btn" title="Pause">⏸</a>'.format(
file_hash=file_hash
)
return _render_page(navigation_data, refresh_meta, image_click_url, play_button=pause_button)
def _find_indexer_for_hash(file_hash: str):