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 @@
-
BROWSE BY DATE FROM OLDEST
-
BROWSE BY DATE FROM NEWEST
+
BROWSE ALL RECENTLY ADDED
+
BROWSE BY PUBLICATION DATE FROM OLDEST
+
BROWSE BY PUBLICATION DATE FROM NEWEST
BROWSE BY CREATOR/CONTRIBUTOR
BROWSE BY PUBLISHER
BROWSE ALL SELF-PUBLISHED
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 @@
- SEE EXAMPLE SEARCH FOR ZINES + BROWSE THE ARCHIVE FROM A-Z CAROLEE SCHNEEMANN CASE STUDY