From 62e2beeab776cd39b6402dfdfc0d40971c69392b Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 27 Aug 2022 21:54:03 +0200 Subject: [PATCH] Add site listing long media - longer than 10 minutes - in opposition to short media - added to navigation header as well --- server/app.py | 14 ++++++++++++++ server/templates/macros.htm | 1 + 2 files changed, 15 insertions(+) diff --git a/server/app.py b/server/app.py index d09834c..fde07a6 100644 --- a/server/app.py +++ b/server/app.py @@ -370,6 +370,20 @@ def list_short_media(seconds: int = 10 * 60): media_list=list(itertools.islice(media_list, 100)), ) + +@flask_app.route("/media/long") +@flask_app.route("/media/long/") +def list_long_media(seconds: int = 10 * 60): + media_list: Iterable[MediaElement] = get_all_considered( + filter_by=f"{seconds} <= (length - progress)", + order_by="elem.release_date DESC, elem.id", + ) + return render_template( + "media_list.htm", + media_list=list(itertools.islice(media_list, 100)), + ) + + @flask_app.route("/media/unsorted") def list_unsorted_media(): media_list: Iterable[MediaElement] = orm.select( diff --git a/server/templates/macros.htm b/server/templates/macros.htm index c83ed2e..1b098a5 100644 --- a/server/templates/macros.htm +++ b/server/templates/macros.htm @@ -66,6 +66,7 @@ "🏠 Home"|safe: "/", "Latest Media": "/media", "Short Media": "/media/short", + "Long Media": "/media/long", "Unsorted Media": "/media/unsorted", "All Collections": "/collection", "Pinned Collections": "/collection/pinned",