From 1b7224956daf53e19aa0c733fd8490ca5c81f2e9 Mon Sep 17 00:00:00 2001 From: zeroth Date: Wed, 28 Jul 2021 09:57:52 +0100 Subject: [PATCH] rcent index homepage buttons etc --- daapinterface.py | 31 +++++++ templates/browsebycategory.html | 5 +- templates/home.html | 4 +- templates/newestindex.html | 2 +- templates/oldestindex.html | 2 +- templates/recentindex.html | 149 ++++++++++++++++++++++++++++++++ 6 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 templates/recentindex.html diff --git a/daapinterface.py b/daapinterface.py index 606ea51..61314ca 100644 --- a/daapinterface.py +++ b/daapinterface.py @@ -131,6 +131,37 @@ def browsebycategory(): # CATEGORIES TO BE BROWSED ######################### +######################### RECENT INDEX +@app.route("/datesindex_recent") +def datesindex_recent(): + sparql.setQuery(''' + SELECT ?work ?workLabel ?image ?date WHERE { + { + SELECT ?work ?workLabel (SAMPLE(?date) AS ?date) + WHERE + { ?work wdt:P1 wd:Q1; + wdt:P13 ?date. + FILTER(?work != wd:Q57) + SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } + } + GROUP BY ?work ?workLabel + ORDER BY ?workLabel + } + SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } + ?work wdt:P1 wd:Q1; + wdt:P87 ?dateadded. + + OPTIONAL {?work p:P90 ?statement. + ?statement ps:P90 ?image; + pq:P54 wd:Q90.} + FILTER(?work != wd:Q57) +} +ORDER BY DESC(?dateadded) + ''') + sparql.setReturnFormat(JSON) + results = sparql.query().convert() + return render_template('recentindex.html', results=results) + ######################### OLDEST INDEX @app.route("/datesindex_asc") def datesindex_asc(): diff --git a/templates/browsebycategory.html b/templates/browsebycategory.html index c64f2a9..2da842b 100644 --- a/templates/browsebycategory.html +++ b/templates/browsebycategory.html @@ -5,8 +5,9 @@
- - + + + diff --git a/templates/home.html b/templates/home.html index c07a22d..cadbd67 100644 --- a/templates/home.html +++ b/templates/home.html @@ -27,7 +27,7 @@