diff --git a/daapinterface.py b/daapinterface.py index 1bf75d1..7043c53 100644 --- a/daapinterface.py +++ b/daapinterface.py @@ -220,8 +220,24 @@ def artwork(): # print(artworkintro) # Image(s) +# query for later + # sparql.setQuery(''' + # SELECT ?image ?depictsLabel ?licenseLabel + # WHERE + # { + # VALUES ?work {wd:'''+artwork_id+'''} + # ?work wdt:P30 ?image. + # OPTIONAL { ?work p:P30 ?statement2. + # ?statement2 ps:P30 ?image; + # pq:P54 ?depicts; + # pq:P56 ?license.} + # SERVICE wikibase:label { bd:serviceParam wikibase:language "en".} + # } + # ''') +# temp fix query + sparql.setQuery(''' - SELECT ?image ?depictsLabel ?licenseLabel + SELECT ?image ?depictsLabel ?licenseLabel WHERE { VALUES ?work {wd:'''+artwork_id+'''} @@ -230,9 +246,10 @@ def artwork(): ?statement2 ps:P30 ?image; pq:P54 ?depicts; pq:P56 ?license.} + FILTER(?depicts != wd:Q1897) SERVICE wikibase:label { bd:serviceParam wikibase:language "en".} - } - ''') + }''') + sparql.setReturnFormat(JSON) artworkimages = sparql.query().convert() print(artworkimages) diff --git a/templates/artwork.html b/templates/artwork.html index 7a65411..802588c 100644 --- a/templates/artwork.html +++ b/templates/artwork.html @@ -45,12 +45,8 @@ {% if artworkimages['results']['bindings']==[] %} {% else %} - {% for x in artworkimages['results']['bindings'] %} - {% if loop.index <= 1 %} - {% if "image" in x %} - - {% endif %} - {% endif %} + {% for x in artworkimages["results"]["bindings"] %} + {% endfor %} {% endif %}