From 8c738ac53b72311650698cfd68520aba05b79168 Mon Sep 17 00:00:00 2001 From: thevickypedia Date: Wed, 10 Jan 2024 19:07:58 +0530 Subject: [PATCH] Add `next` and `previous` buttons only when content is available --- pystream/routers/video.py | 3 +-- pystream/templates/index.html | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pystream/routers/video.py b/pystream/routers/video.py index 1a201f3..456e105 100644 --- a/pystream/routers/video.py +++ b/pystream/routers/video.py @@ -75,11 +75,10 @@ async def stream_video(request: Request, ) if pure_path.exists(): prev_, next_ = squire.get_iter(pure_path) - # fixme: perhaps, remove previous and next buttons in template instead of defaulting to # attrs = { "request": request, "title": video_path, "path": f"{config.static.streaming_endpoint}?{config.static.query_param}={urlparse.quote(str(pure_path))}", - "previous": prev_ or "#", "next": next_ or "#" + "previous": prev_, "next": next_ } # set default to avoid broken image sign in thumbnail preview_src = os.path.join(pathlib.PurePath(__file__).parent, "blank.jpg") diff --git a/pystream/templates/index.html b/pystream/templates/index.html index e26779c..664dd45 100644 --- a/pystream/templates/index.html +++ b/pystream/templates/index.html @@ -129,12 +129,16 @@

{{title}}

supports HTML5 video

+{% if previous %} +{% endif %} +{% if next %} +{% endif %}