Skip to content

Commit

Permalink
Merge pull request #135 from ArchiveLabs/add-ia-logo
Browse files Browse the repository at this point in the history
Add ia logo
  • Loading branch information
digitaldogsbody authored Aug 2, 2023
2 parents 1768a83 + 293bf29 commit 1129283
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
14 changes: 13 additions & 1 deletion iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,19 @@ def addMetadata(item, identifier, metadata, collection=False):

item.provider = [{"id": "https://archive.org",
"type": "Agent",
"label": {"en": ["The Internet Archive"]}}]
"label": {"en": ["The Internet Archive"]},
"homepage": [{"id": "https://archive.org",
"type": "Text",
"label": {"en": ["Internet Archive Homepage"]},
"format": "text/html"}],
"logo": [{
"id": "https://archive.org/images/glogo.png",
"type": "Image",
"format": "image/png",
"height": 79,
"width": 79
}],
}]

if "licenseurl" in metadata:
item.rights = metadata["licenseurl"].replace("https", "http", 1)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_v3_collection(self):
collection = resp.json

self.assertEqual(collection['type'], "Collection", f"Unexpected type. Expected collection got {collection['type']}")
self.assertEqual(len(collection['items']),1001,f"Expected 1000 items but got: {len(collection['items'])}")
self.assertEqual(len(collection['items']),1001,f"Expected 1001 items but got: {len(collection['items'])}")
self.assertEqual(collection['items'][-1]['type'],'Collection',"Expected last item to be a collection pointing to the next set of results")


Expand Down
7 changes: 7 additions & 0 deletions tests/test_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ def test_v3_aiff(self):
self.assertEqual(len(manifest['items']),38,f"Expected 38 canvases but got: {len(manifest['items'])}")
self.assertEqual("AIFF".lower() in resp.text.lower(), True, f"Expected the string 'AIFF'")

def test_provider_logo(self):
resp = self.test_app.get("/iiif/3/rashodgson68/manifest.json")
self.assertEqual(resp.status_code, 200)
manifest = resp.json
self.assertEqual(manifest['provider'][0]['homepage'][0]['id'] == "https://archive.org", True, f"Expected 'https://archive.org' but got {manifest['provider'][0]['id']}")
self.assertEqual(manifest['provider'][0]['logo'][0]['id'] == "https://archive.org/images/glogo.png", True, f"Expected logo URI but got {manifest['provider'][0]['logo'][0]['id']}")

''' to test:
kaled_jalil (no derivatives)
Dokku_obrash (geo-restricted?)
Expand Down

0 comments on commit 1129283

Please sign in to comment.