-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding list of renderings and seeAlsos
- Loading branch information
1 parent
6238b9b
commit a1900d9
Showing
4 changed files
with
272 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ | ||
"Animated GIF": { | ||
"field": "rendering", | ||
"type": "Image", | ||
"format": "image/gif" | ||
}, | ||
"Text PDF": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "application/pdf" | ||
}, | ||
"Abbyy GZ": { | ||
"field": "rendering", | ||
"type": "Dataset", | ||
"format": "application/gzip" | ||
}, | ||
"Archive BitTorrent": { | ||
"field": "rendering", | ||
"type": "Dataset", | ||
"format": "application/x-bittorrent" | ||
}, | ||
"Grayscale PDF": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "application/pdf" | ||
}, | ||
"chOCR": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "application/gzip" | ||
}, | ||
"DjVuTXT": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "text/plain" | ||
}, | ||
"Djvu XML": { | ||
"field": "rendering", | ||
"type": "Dataset", | ||
"format": "application/xml" | ||
}, | ||
"hOCR": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "text/html" | ||
}, | ||
"Single Page Processed JP2 ZIP": { | ||
"field": "rendering", | ||
"type": "Image", | ||
"format": "application/zip" | ||
}, | ||
"OCR Search Text": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "application/gzip" | ||
}, | ||
"Single Page Original JP2 Tar": { | ||
"field": "rendering", | ||
"type": "Image", | ||
"format": "application/x-tar" | ||
}, | ||
"DjVu": { | ||
"field": "rendering", | ||
"type": "Image", | ||
"format": "image/vnd.djvu" | ||
}, | ||
"Cloth Cover Detection Log": { | ||
"field": "seeAlso", | ||
"type": "Text", | ||
"format": "text/plain" | ||
}, | ||
"Dublin Core": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/xml" | ||
}, | ||
"OCR Page Index": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/json" | ||
}, | ||
"MARC": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/xml" | ||
}, | ||
"MARC Binary": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/marc" | ||
}, | ||
"MARC Source": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/xml" | ||
}, | ||
"Page Numbers JSON": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/json" | ||
}, | ||
"Scandata": { | ||
"field": "seeAlso", | ||
"type": "Dataset", | ||
"format": "application/xml" | ||
}, | ||
"SubRip": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "text/plain" | ||
}, | ||
"Web Video Text Tracks": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "text/vtt" | ||
}, | ||
"Intermediate ASR JSON": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "application/json" | ||
}, | ||
"Whisper ASR JSON": { | ||
"field": "rendering", | ||
"type": "Text", | ||
"format": "application/json" | ||
}, | ||
"Storj Upload Log": { | ||
"field": "seeAlso", | ||
"type": "Text", | ||
"format": "text/plain" | ||
}, | ||
"Storj Upload Trigger": { | ||
"field": "seeAlso", | ||
"type": "Text", | ||
"format": "text/plain" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import unittest | ||
from flask.testing import FlaskClient | ||
from iiify.app import app | ||
|
||
class TestLinking(unittest.TestCase): | ||
|
||
def setUp(self) -> None: | ||
self.test_app = FlaskClient(app) | ||
|
||
def convertListToHash(self, items): | ||
map = {} | ||
for item in items: | ||
map[item['label']['en'][0]] = item | ||
return map | ||
|
||
def checkLink(self, map, field, name, value): | ||
self.assertTrue(name in map, f"Expected to find {name} in {field}") | ||
|
||
self.assertEqual(map[name]['id'], value, f"Expected {value} in {map[name]}") | ||
|
||
def test_v3_image_links(self): | ||
resp = self.test_app.get("/iiif/3/journalofexpedit00ford/manifest.json?recache=true") | ||
self.assertEqual(resp.status_code, 200) | ||
manifest = resp.json | ||
|
||
self.assertTrue('rendering' in manifest, "Expected rendering in Manifest") | ||
renderingMap = self.convertListToHash(manifest['rendering']) | ||
# Animated GIF - rendering | ||
self.checkLink(renderingMap, "rendering", "Animated GIF", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford.gif") | ||
# Text PDF - rendering | ||
self.checkLink(renderingMap, "rendering", "Text PDF", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford.pdf") | ||
# Abbyy GZ - rendering | ||
self.checkLink(renderingMap, "rendering", "Abbyy GZ", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_abbyy.gz") | ||
# Archive BitTorrent - rendering | ||
self.checkLink(renderingMap, "rendering", "Archive BitTorrent", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_archive.torrent") | ||
# Grayscale PDF - rendering | ||
self.checkLink(renderingMap, "rendering", "Grayscale PDF", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_bw.pdf") | ||
# chOCR - rendering | ||
self.checkLink(renderingMap, "rendering", "chOCR", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_chocr.html.gz") | ||
# DjVuTXT - rendering | ||
self.checkLink(renderingMap, "rendering", "DjVuTXT", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_djvu.txt") | ||
# Djvu XML - rendering | ||
self.checkLink(renderingMap, "rendering", "Djvu XML", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_djvu.xml") | ||
# hOCR - rendering | ||
self.checkLink(renderingMap, "rendering", "hOCR", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_hocr.html") | ||
# Single Page Processed JP2 ZIP - rendering | ||
self.checkLink(renderingMap, "rendering", "Single Page Processed JP2 ZIP", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_jp2.zip") | ||
# OCR Search Text - rendering | ||
self.checkLink(renderingMap, "rendering", "OCR Search Text", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_hocr_searchtext.txt.gz") | ||
# Single Page Original JP2 Tar - rendering | ||
self.checkLink(renderingMap, "rendering", "Single Page Original JP2 Tar", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_orig_jp2.tar") | ||
# DjVu - rendering | ||
self.checkLink(renderingMap, "rendering", "DjVu", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford.djvu") | ||
|
||
self.assertTrue('seeAlso' in manifest, "Expected seeAlso in Manifest") | ||
seeAlsoMap = self.convertListToHash(manifest['seeAlso']) | ||
# Cloth Cover Detection Log - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "Cloth Cover Detection Log", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_cloth_detection.log") | ||
# Dublin Core - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "Dublin Core", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_dc.xml") | ||
# OCR Page Index - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "OCR Page Index", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_hocr_pageindex.json.gz") | ||
# MARC - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "MARC", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_marc.xml") | ||
# MARC Binary - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "MARC Binary", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_meta.mrc") | ||
# MARC Source - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "MARC Source", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_metasource.xml") | ||
# Page Numbers JSON - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "Page Numbers JSON", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_page_numbers.json") | ||
# Scandata - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "Scandata", "https://archive.org/download/journalofexpedit00ford/journalofexpedit00ford_scandata.xml") | ||
|
||
def test_v3_video_links(self): | ||
resp = self.test_app.get("/iiif/3/DuckandC1951/manifest.json?recache=true") | ||
self.assertEqual(resp.status_code, 200) | ||
manifest = resp.json | ||
|
||
self.assertTrue('rendering' in manifest, "Expected rendering in Manifest") | ||
renderingMap = self.convertListToHash(manifest['rendering']) | ||
seeAlsoMap = self.convertListToHash(manifest['seeAlso']) | ||
self.assertTrue("Unknown" not in renderingMap and "Unknown" not in seeAlsoMap, "Found Unknown in rendering or seeAlso where it shouldn't be.") | ||
|
||
# SubRip - rendering | ||
self.checkLink(renderingMap, "rendering", "SubRip", "https://archive.org/download/DuckandC1951/DuckandC1951.asr.srt") | ||
# Web Video Text Tracks - rendering | ||
self.checkLink(renderingMap, "rendering", "Web Video Text Tracks", "https://archive.org/download/DuckandC1951/DuckandC1951.asr.vtt") | ||
# Archive BitTorrent - rendering | ||
self.checkLink(renderingMap, "rendering", "Archive BitTorrent", "https://archive.org/download/DuckandC1951/DuckandC1951_archive.torrent") | ||
# Intermediate ASR JSON - rendering | ||
self.checkLink(renderingMap, "rendering", "Intermediate ASR JSON", "https://archive.org/download/DuckandC1951/DuckandC1951_intermediate_asr.json") | ||
# Whisper ASR JSON | ||
self.checkLink(renderingMap, "rendering", "Whisper ASR JSON", "https://archive.org/download/DuckandC1951/DuckandC1951_whisper_asr.json") | ||
|
||
# Storj Upload Log - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "Storj Upload Log", "https://archive.org/download/DuckandC1951/DuckandC1951.storj-store.log") | ||
# Storj Upload Trigger - seeAlso | ||
self.checkLink(seeAlsoMap, "seeAlso", "Storj Upload Trigger", "https://archive.org/download/DuckandC1951/DuckandC1951.storj-store.trigger") | ||
|
||
# Thumbnail - thumbnail | ||
# 19 thumbs | ||
self.assertEqual(len(manifest['thumbnail']), 19, f"Expected 19 thumbnails: {manifest['thumbnail']}") |