├── tests
├── __init__.py
├── input_data
│ ├── collection-basic.json
│ ├── manifest-services.json
│ ├── manifest-annos.json
│ ├── manifest-sequences.json
│ └── manifest-basic.json
├── remote_cache
│ ├── tokyo.annolist.json
│ ├── tokyo.manifest.json
│ ├── getty.manifest.edu
│ ├── ghent.manifest.edu
│ ├── dublin.manifest.json
│ ├── harvard-art.manifest.json
│ ├── ycba.manifest.json
│ ├── ncsu.annolist.json
│ ├── ncsu.manifest.json
│ └── nlw-newspaper.manifest.json
└── test_upgrader.py
├── requirements.txt
├── iiif_prezi_upgrader
├── __init__.py
├── _version.py
└── prezi_upgrader.py
├── Dockerfile
├── prezi2to3.wsgi
├── .travis.yml
├── setup.py
├── .gitignore
├── prezi2to3.py
├── README.md
├── twoToThreeUpgraderService.py
├── templates
└── index.tpl
└── LICENSE
/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | bottle
2 | requests
3 |
--------------------------------------------------------------------------------
/iiif_prezi_upgrader/__init__.py:
--------------------------------------------------------------------------------
1 |
2 | from ._version import __version__
3 | from .prezi_upgrader import Upgrader
--------------------------------------------------------------------------------
/iiif_prezi_upgrader/_version.py:
--------------------------------------------------------------------------------
1 | """Version number for this IIIF Presentation API Upgrader library."""
2 | __version__ = '0.1.0'
3 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM grahamdumpleton/mod-wsgi-docker:python-3.5-onbuild
2 | # Run tests:
3 | RUN python setup.py test
4 |
5 | CMD [ "prezi2to3.wsgi" ]
6 |
--------------------------------------------------------------------------------
/prezi2to3.wsgi:
--------------------------------------------------------------------------------
1 | import os
2 | # Change working directory so relative paths (and template lookup) work again
3 | os.chdir(os.path.dirname(__file__))
4 |
5 | import bottle
6 | from twoToThreeUpgraderService import Service
7 | # ... build or import your bottle application here ...
8 | # Do NOT use bottle.run() with mod_wsgi
9 | s = Service()
10 | application = s.get_bottle_app()
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | python:
3 | - "2.7"
4 | - "3.5"
5 | - "3.6"
6 | install:
7 | - pip install coveralls
8 | - python setup.py install
9 | script:
10 | - python setup.py test
11 | - python prezi2to3.py tests/input_data/manifest-basic.json --output /dev/null
12 | after_success:
13 | - coverage run --source=iiif_prezi_upgrader setup.py test
14 | - coveralls
15 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | """Setup for iiif-prezi-upgrader."""
2 | from setuptools import setup
3 | import sys
4 |
5 | setup(
6 | name='iiif-prezi-upgrader',
7 | packages=['iiif_prezi_upgrader'],
8 | test_suite="tests",
9 | version='0.1.0',
10 | description='A library to upgrade ',
11 | author='Rob Sanderson, Simeon Warner, Glen Robson',
12 | author_email='rsanderson@getty.edu',
13 | url='https://github.com/iiif-prezi/prezi-2-to-3',
14 | classifiers=[
15 | "Programming Language :: Python",
16 | "Programming Language :: Python :: 3",
17 | "Programming Language :: Python :: 2",
18 | "License :: OSI Approved :: Apache Software License",
19 | "Development Status :: 3 - Alpha",
20 | "Intended Audience :: Developers",
21 | "Operating System :: OS Independent",
22 | "Topic :: Software Development :: Libraries :: Python Modules",
23 | ]
24 | )
25 |
--------------------------------------------------------------------------------
/tests/input_data/collection-basic.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "http://example.org/iiif/collection/top",
4 | "@type": "sc:Collection",
5 | "label": "Top Level Collection for Example Organization",
6 | "viewingHint": "top",
7 | "description": "Description of Collection",
8 | "attribution": "Provided by Example Organization",
9 |
10 | "collections": [
11 | {
12 | "@id": "http://example.org/iiif/collection/sub1",
13 | "@type": "sc:Collection",
14 | "label": "Sub-Collection 1",
15 |
16 | "members": [
17 | {
18 | "@id": "http://example.org/iiif/collection/part1",
19 | "@type": "sc:Collection",
20 | "label": "My Multi-volume Set",
21 | "viewingHint": "multi-part"
22 | },
23 | {
24 | "@id": "http://example.org/iiif/book1/manifest1",
25 | "@type": "sc:Manifest",
26 | "label": "My Book"
27 | },
28 | {
29 | "@id": "http://example.org/iiif/collection/part2",
30 | "@type": "sc:Collection",
31 | "label": "My Sub Collection",
32 | "viewingHint": "individuals"
33 | }
34 | ]
35 | },
36 | {
37 | "@id": "http://example.org/iiif/collection/part2",
38 | "@type": "sc:Collection",
39 | "label": "Sub Collection 2"
40 | }
41 | ],
42 |
43 | "manifests": [
44 | {
45 | "@id": "http://example.org/iiif/book1/manifest",
46 | "@type": "sc:Manifest",
47 | "label": "Book 1"
48 | }
49 | ]
50 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | env/
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *.cover
47 | .hypothesis/
48 |
49 | # Translations
50 | *.mo
51 | *.pot
52 |
53 | # Django stuff:
54 | *.log
55 | local_settings.py
56 |
57 | # Flask stuff:
58 | instance/
59 | .webassets-cache
60 |
61 | # Scrapy stuff:
62 | .scrapy
63 |
64 | # Sphinx documentation
65 | docs/_build/
66 |
67 | # PyBuilder
68 | target/
69 |
70 | # Jupyter Notebook
71 | .ipynb_checkpoints
72 |
73 | # pyenv
74 | .python-version
75 |
76 | # celery beat schedule file
77 | celerybeat-schedule
78 |
79 | # SageMath parsed files
80 | *.sage.py
81 |
82 | # dotenv
83 | .env
84 |
85 | # virtualenv
86 | .venv
87 | venv/
88 | ENV/
89 |
90 | # Spyder project settings
91 | .spyderproject
92 | .spyproject
93 |
94 | # Rope project settings
95 | .ropeproject
96 |
97 | # mkdocs documentation
98 | /site
99 |
100 | # mypy
101 | .mypy_cache/
102 |
--------------------------------------------------------------------------------
/prezi2to3.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # encoding: utf-8
3 | """IIIF Convertor Service"""
4 |
5 | import argparse
6 | import json
7 | import os
8 | import sys
9 |
10 | from iiif_prezi_upgrader import Upgrader
11 | from iiif_prezi_upgrader.prezi_upgrader import FLAGS
12 |
13 | if __name__ == "__main__":
14 | #if len(sys.argv) != 2 and len(sys.argv) != 3:
15 | # print ('Usage:\n\tpython prezi2to3.py [file_path or url to manifest] [optional output file name]')
16 | # sys.exit(0)
17 |
18 | parser = argparse.ArgumentParser(description=__doc__.strip(),
19 | formatter_class=argparse.ArgumentDefaultsHelpFormatter)
20 | parser.add_argument('manifest', metavar='manifest', type=str, help='file_path or url to manifest')
21 | parser.add_argument('--output', metavar='filename', type=str, help='output file name')
22 | for key in FLAGS:
23 | name=key
24 | description=FLAGS[key]['description']
25 | default=FLAGS[key]['default']
26 | type=type(default)
27 | if FLAGS[key]['default'] is not str:
28 | type=bool
29 | parser.add_argument('--%s' % name, default=default, type=type, help=description)
30 |
31 |
32 | args = parser.parse_args()
33 |
34 | manifest = args.manifest
35 | # default flags currently but if flags are assessible then could convert them to use --ext_ok=true using ArgumentParser
36 | upgrader = Upgrader(flags=vars(args)) # create an upgrader
37 | if 'http' in manifest: # should catch https as well
38 | v3 = upgrader.process_uri(manifest)
39 | else:
40 | v3 = upgrader.process_cached(manifest)
41 |
42 | v3 = upgrader.reorder(v3)
43 |
44 | if args.output:
45 | # output to filename
46 | with open(args.output, 'w') as outfile:
47 | json.dump(v3, outfile, indent=2)
48 | else:
49 | print(json.dumps(v3, indent=2))
50 |
--------------------------------------------------------------------------------
/tests/remote_cache/tokyo.annolist.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/list/p0001-0025.json",
4 | "@type": "sc:AnnotationList",
5 | "resources": [
6 | {
7 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025/1",
8 | "@type": "oa:Annotation",
9 | "motivation": "oa:classifying",
10 | "resource": {
11 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025/1/1",
12 | "@type": "cnt:ContentAsText",
13 | "language": "ja",
14 | "format": "text/html",
15 | "chars": "
大日如來
(仏・如來)
目の数 : 二目 額 : 白毫無 持物 : 輪宝 , 臂数 : 二臂 台座 : 蓮華 , 光背 : 炎光 , 顔の向き : 正面 タグ付け担当: 永崎研宣
"
16 | },
17 | "on": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025#xywh=9912,13519,2583,2663"
18 | },
19 | {
20 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025/2",
21 | "@type": "oa:Annotation",
22 | "motivation": "oa:classifying",
23 | "resource": {
24 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025/2/1",
25 | "@type": "cnt:ContentAsText",
26 | "language": "ja",
27 | "format": "text/html",
28 | "chars": "八葉院
(曼荼羅)
目の数 : 二目 額 : 白毫無 臂数 : 二臂 タグ付け担当: 永崎研宣
"
29 | },
30 | "on": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025#xywh=8457,11791,5583,6317"
31 | }
32 | ]
33 | }
--------------------------------------------------------------------------------
/tests/input_data/manifest-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/1/manifest.json",
4 | "@type": "sc:Manifest",
5 | "label": "Manifest Label",
6 |
7 | "service": {
8 | "@context": "http://iiif.io/api/search/1/context.json",
9 | "@id": "http://example.org/services/identifier/search",
10 | "profile": "http://iiif.io/api/search/1/search",
11 | "service": {
12 | "@id": "http://example.org/services/identifier/autocomplete",
13 | "profile": "http://iiif.io/api/search/1/autocomplete"
14 | }
15 | },
16 |
17 | "sequences": [
18 | {
19 | "@type": "sc:Sequence",
20 | "label": "Current Order",
21 | "canvases": [
22 | {
23 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
24 | "@type": "sc:Canvas",
25 | "label": "Test 1 Canvas: 1",
26 | "height": 1800,
27 | "width": 1200,
28 | "images": [
29 | {
30 | "@type": "oa:Annotation",
31 | "motivation": "sc:painting",
32 | "resource": {
33 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/resources/page1-full.png",
34 | "@type": "dctypes:Image",
35 |
36 | "service": {
37 | "@context": "http://iiif.io/api/image/2/context.json",
38 | "@id": "http://example.org/iiif/book1-page1",
39 | "profile": "http://iiif.io/api/image/2/level2.json",
40 | "service": {
41 | "@context": "http://iiif.io/api/auth/1/context.json",
42 | "@id": "https://authentication.example.org/login",
43 | "profile": "http://iiif.io/api/auth/1/login",
44 | "label": "Login to Example Institution",
45 | "header": "Please Log In",
46 | "description": "Example Institution requires that you log in with your example account to view this content.",
47 | "confirmLabel": "Login",
48 | "failureHeader": "Authentication Failed",
49 | "failureDescription": "Access Policy ",
50 | "service": [
51 | {
52 | "@id": "https://authentication.example.org/token",
53 | "profile": "http://iiif.io/api/auth/1/token"
54 | },
55 | {
56 | "@id": "https://authentication.example.org/logout",
57 | "profile": "http://iiif.io/api/auth/1/logout",
58 | "label": "Logout from Example Institution"
59 | }
60 | ]
61 | }
62 | }
63 |
64 | },
65 | "on": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json"
66 | }
67 | ]
68 | }
69 | ]
70 | }
71 | ]
72 | }
--------------------------------------------------------------------------------
/tests/remote_cache/tokyo.manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@type": "sc:Manifest",
4 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/manifest.json",
5 | "label": "大正新脩大藏經図像部第12b02巻",
6 | "metadata": [
7 | {
8 | "label": "Author",
9 | "value": "高楠順次郎"
10 | },
11 | {
12 | "label": "published",
13 | "value": [
14 | {
15 | "@value": "大蔵出版",
16 | "@language": "ja"
17 | }
18 | ]
19 | },
20 | {
21 | "label": "Source",
22 | "value": "大正新脩大藏經 図像部"
23 | },
24 | {
25 | "label": "manifest URI",
26 | "value": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/manifest.json"
27 | }
28 | ],
29 | "description": "大正新脩大藏經図像部",
30 | "viewingDirection": "right-to-left",
31 | "viewingHint": "paged",
32 | "license": "http://creativecommons.org/licenses/by-sa/4.0/",
33 | "attribution": "大蔵出版(Daizo shuppan) and SAT大蔵経テキストデータベース研究会(SAT Daizōkyō Text Database Committee) ",
34 | "logo": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/satlogo80.png",
35 | "sequences": [
36 | {
37 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/zuzoubu/12b02/sequence.json",
38 | "@type": "sc:Sequence",
39 | "label": "Current Page Order",
40 | "canvases": [
41 | {
42 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025",
43 | "@type": "sc:Canvas",
44 | "label": "",
45 | "width": 22779,
46 | "height": 30000,
47 | "images": [
48 | {
49 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/ano0001-0025",
50 | "@type": "oa:Annotation",
51 | "motivation": "sc:painting",
52 | "resource": {
53 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiifimgs/zuzoubu/12b02/0001-0025.tif/full/full/0/default.jpg",
54 | "@type": "dctypes:Image",
55 | "format": "image/jpeg",
56 | "width": 22779,
57 | "height": 30000,
58 | "service": {
59 | "@context": "http://iiif.io/api/image/2/context.json",
60 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiifimgs/zuzoubu/12b02/0001-0025.tif",
61 | "profile": "http://iiif.io/api/image/2/level1.json"
62 | }
63 | },
64 | "on": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/p0001-0025"
65 | }
66 | ],
67 | "otherContent": [
68 | {
69 | "@id": "https://dzkimgs.l.u-tokyo.ac.jp/iiif/zuzoubu/12b02/list/p0001-0025.json",
70 | "@type": "sc:AnnotationList"
71 | }
72 | ]
73 | }
74 | ]
75 | }
76 | ]
77 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # prezi-2-to-3
2 |
3 | [](https://travis-ci.org/iiif/prezi-2-to-3)
4 | [](https://coveralls.io/github/iiif/prezi-2-to-3?branch=master)
5 |
6 | Libraries to upgrade IIIF Presentation API manifest from v2 to v3 automatically
7 |
8 |
9 | # Usage:
10 |
11 | There are three options on how to use this program either through Docker, installed locally or programatically. Details below:
12 |
13 | ## Using Docker
14 |
15 | Build the docker image:
16 |
17 | ```
18 | docker build -t prezi-2-to-3 .
19 | ```
20 |
21 | Run the image:
22 |
23 | ```
24 | docker run -it --rm -p 8000:80 --name upgrader prezi-2-to-3:latest
25 | ```
26 |
27 | or run both with the following command:
28 |
29 | ```
30 | docker build -t prezi-2-to-3 . && docker run -it --rm -p 8000:80 --name upgrader prezi-2-to-3:latest
31 | ```
32 |
33 | Then navigating to the following page: .
34 |
35 | ## Installing locally
36 |
37 | ```
38 | sudo python setup.py install
39 | ```
40 |
41 | You can then either run a web version or run it from the command line.
42 |
43 | ### Command line
44 |
45 | Usage:
46 |
47 | ```
48 | python prezi2to3.py
49 | Usage:
50 | python prezi2to3.py [file_path or url to manifest] [optional output file name]
51 | ```
52 |
53 | Examples:
54 |
55 | ```
56 | # Convert manifest from filesystem and print results to screen
57 | python prezi2to3.py tests/input_data/manifest-services.json
58 |
59 | # Convert remote manfiest and save results to /tmp/upgraded.json
60 | python prezi2to3.py http://iiif.io/api/presentation/2.1/example/fixtures/1/manifest.json /tmp/upgraded.json
61 | ```
62 |
63 | ### Web version
64 | To run the web version:
65 |
66 | ```
67 | ./twoToThreeUpgraderService.py --port 8000
68 | ```
69 |
70 | and navigate to . Note the default port if not specified is 8080.
71 |
72 | ## Using programatically
73 |
74 | Create an Upgrader, and then call `process_cached` with the path to a version 2.x IIIF Presentation API resource on disk, or `process_uri` with a URI to the same. If the JSON is already in memory, then call `process_resource` instead. The results of the call will be the JSON of the equivalent version 3.0 resource.
75 |
76 | ```python
77 | from iiif_prezi_upgrader import Upgrader
78 | upgrader = Upgrader(flags={"flag_name" : "flag_value"}) # create an upgrader
79 | v3 = upgrader.process_cached("/path/to/iiif/v2/file.json")
80 | v3 = upgrader.process_uri("http://example.org/iiif/v2/file.json")
81 | v3 = upgrader.process_resource(json, top=True)
82 | ```
83 |
84 | ## Flags
85 |
86 | * `desc_2_md` : The `description` property is not a summary, and hence should be put in as a `metadata` pair. The label generated will be "Description". The default is `True`.
87 | * `related_2_md` : The `related` property is not a homepage, and hence should be put in as a `metadata` pair. The label generated will be "Related". The default is `False` (and hence the property will simply be renamed as `homepage`)
88 | * `ext_ok` : Should extensions be copied through to the new version. The default is `False`.
89 | * `default_lang` : The default language to use for language maps. The default is "@none".
90 | * `deref_links` : Should links without a `format` property be dereferenced and the HTTP response inspected for the media type? The default is `True`.
91 | * `debug` : Are we in debug mode and should spit out more warnings than normal? The default is `False`
92 |
93 |
94 | # FAQ
95 |
96 | * Does this rely on iiif-prezi's ManifestFactory? No. It has as few dependencies as possible to allow it to be ported to other languages.
97 | * Is it up to date? It is developed by two of the IIIF Editors (@azaroth42 and @zimeon) and we try to keep it up to date with the latest draft version 3.0 Presentation API specs.
98 | * Are PRs welcome? Yes :)
99 |
--------------------------------------------------------------------------------
/tests/remote_cache/getty.manifest.edu:
--------------------------------------------------------------------------------
1 | {"@context":"http:\/\/iiif.io\/api\/presentation\/2\/context.json","@id":"https:\/\/data.getty.edu\/museum\/api\/iiif\/298147\/manifest.json","@type":"sc:Manifest","label":"La Surprise (1718\u20131719), Jean-Antoine Watteau (French, 1684 - 1721)","description":"In a verdant park at sunset, a young woman abandons herself to her tousle-haired companion\u2019s ardent embrace. Coiled up in a pose of centrifugal energy, the impulsive lovers are oblivious to the third figure: Mezzetin, sitting on the same rocky outcrop. Drawn from the theatrical tradition of the commedia dell\u2019arte, this character represents a poignant foil to the couple\u2019s unbridled passion. Introverted and with a melancholy air, he tunes his guitar, knowing that his serenading will mean nothing to the lovers and serve only to heighten his own sense of lonely longing as he gazes upon them. His costume, a rose-coloured jacket and knee-britches slashed with yellow and adorned with blue ribbons as well as a lace ruff and cuffs, is reminiscent of the paintings of Anthony van Dyck. The small dog at lower right, a quotation from Rubens, watches the couple with considerably more appreciation than Mezzetin can muster.","metadata":[{"label":"Artist \/ Maker","value":"Jean-Antoine Watteau (French, 1684 - 1721)"},{"label":"Culture & Date","value":"French, 1718\u20131719"},{"label":"Medium","value":"Oil on panel"},{"label":"Dimensions","value":"36.4 \u00d7 28.2 cm (14 5\/16 \u00d7 11 1\/8 in.)"},{"label":"Object Number","value":"2017.72"},{"label":"Object Type","value":"Painting"},{"label":"Place Created","value":"France"},{"label":"Collection","value":"The J. Paul Getty Museum<\/a>"},{"label":"Rights Statement","value":"Images provided here are believed to be in the public domain and are made available under the terms of the Getty's
Open Content Program<\/a><\/nobr>. Texts provided here are \u00a9 J. Paul Getty Trust, licensed under CC BY 4.0<\/a>. Terms of use for the Getty logo can be found here<\/a>.<\/div>"}],"thumbnail":"https:\/\/data.getty.edu\/museum\/api\/iiif\/633385\/full\/231,300\/0\/default.jpg","viewingDirection":"left-to-right","license":"http:\/\/www.getty.edu\/legal\/copyright.html#oc","attribution":"Digital image courtesy of the Getty's Open Content Program<\/a>.","logo":"http:\/\/www.getty.edu\/museum\/media\/graphics\/web\/logos\/getty-logo.png","within":"http:\/\/www.getty.edu\/art\/collection\/","sequences":[{"@id":"https:\/\/data.getty.edu\/museum\/api\/iiif\/298147\/sequence\/main","@type":"sc:Sequence","label":"Object","viewingDirection":"left-to-right","viewingHint":"paged","startCanvas":"https:\/\/data.getty.edu\/museum\/api\/iiif\/298147\/canvas\/main","canvases":[{"@id":"https:\/\/data.getty.edu\/museum\/api\/iiif\/298147\/canvas\/main","@type":"sc:Canvas","label":"Main Image","width":4937,"height":6406,"images":[{"@id":"https:\/\/data.getty.edu\/museum\/api\/iiif\/298147\/annotation\/main-image","@type":"oa:Annotation","motivation":"sc:painting","resource":{"@id":"https:\/\/data.getty.edu\/museum\/api\/iiif\/633385\/full\/789,1024\/0\/default.jpg","@type":"dctypes:Image","format":"image\/jpeg","service":{"@context":"http:\/\/iiif.io\/api\/image\/2\/context.json","@id":"https:\/\/data.getty.edu\/museum\/api\/iiif\/633385","profile":"http:\/\/iiif.io\/api\/image\/2\/level0.json"},"width":789,"height":1024},"on":"https:\/\/data.getty.edu\/museum\/api\/iiif\/298147\/canvas\/main"}],"thumbnail":"https:\/\/data.getty.edu\/museum\/api\/iiif\/633385\/full\/231,300\/0\/default.jpg"}]}],"related":"https:\/\/www.getty.edu\/art\/collection\/objects\/298147\/jean-antoine-watteau-la-surprise-french-1718-1719\/"}
--------------------------------------------------------------------------------
/tests/input_data/manifest-annos.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/1/manifest.json",
4 | "@type": "sc:Manifest",
5 | "label": "Manifest Label",
6 | "sequences": [
7 | {
8 | "@type": "sc:Sequence",
9 | "label": "Current Order",
10 | "canvases": [
11 | {
12 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
13 | "@type": "sc:Canvas",
14 | "label": "Test 1 Canvas: 1",
15 | "height": 1800,
16 | "width": 1200,
17 | "images": [
18 | {
19 | "@type": "oa:Annotation",
20 | "motivation": "sc:painting",
21 | "resource": {
22 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/resources/page1-full.png",
23 | "@type": "dctypes:Image"
24 | },
25 | "on": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json"
26 | },
27 | {
28 | "@id": "http://example.org/iiif/book1/annotation/anno1",
29 | "@type": "oa:Annotation",
30 | "motivation": "sc:painting",
31 | "resource": {
32 | "@id": "http://www.example.org/iiif/book1-page1/50,50,1250,1850/full/0/default.jpg",
33 | "@type": "oa:SpecificResource",
34 | "full": {
35 | "@id": "http://example.org/iiif/book1-page1/full/full/0/default.jpg",
36 | "@type": "dctypes:Image"
37 | },
38 | "selector": {
39 | "@context": "http://iiif.io/api/annex/openannotation/context.json",
40 | "@type": "iiif:ImageApiSelector",
41 | "region": "50,50,1250,1850"
42 | }
43 | },
44 | "on": "http://www.example.org/iiif/book1/canvas/p1#xywh=0,0,600,900"
45 | },
46 | {
47 | "@id": "http://example.org/iiif/book1/annotation/p1",
48 | "@type": "oa:Annotation",
49 | "motivation": "sc:painting",
50 | "resource":{
51 | "@type": "cnt:ContentAsText",
52 | "chars": "Here starts book one...",
53 | "format": "text/plain",
54 | "language": "en"
55 | },
56 | "on": "http://example.org/iiif/book1/canvas/p1#xywh=100,150,500,25"
57 | },
58 | {
59 | "@id": "http://example.org/iiif/book1/annotation/anno1",
60 | "@type": "oa:Annotation",
61 | "motivation": "sc:painting",
62 | "resource":{
63 | "@type": "oa:Choice",
64 | "default":{
65 | "@id": "http://example.org/iiif/book1/res/page1.jpg",
66 | "@type": "dctypes:Image",
67 | "label": "Color"
68 | },
69 | "item": [
70 | {
71 | "@id": "http://example.org/iiif/book1/res/page1-blackandwhite.jpg",
72 | "@type": "dctypes:Image",
73 | "label": "Black and White"
74 | }
75 | ]
76 | },
77 | "on": "http://example.org/iiif/book1/canvas/p1"
78 | },
79 | {
80 | "@id": "http://example.org/iiif/book1/annotation/anno1",
81 | "@type": "oa:Annotation",
82 | "motivation": "sc:painting",
83 | "stylesheet":{
84 | "@type": ["oa:CssStyle", "cnt:ContentAsText"],
85 | "chars": ".red {color: red;}"
86 | },
87 | "resource":{
88 | "@type": "oa:SpecificResource",
89 | "style": "red",
90 | "full": {
91 | "@type": "cnt:ContentAsText",
92 | "chars": "Rubrics are Red, ..."
93 | }
94 | },
95 | "on": "http://example.org/iiif/book1/canvas/p1#xywh=100,150,500,30"
96 | }
97 |
98 | ]
99 | }
100 | ]
101 | }
102 | ]
103 | }
--------------------------------------------------------------------------------
/tests/input_data/manifest-sequences.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/1/manifest.json",
4 | "@type": "sc:Manifest",
5 | "label": "Manifest Label",
6 | "description": "This is a description of the Manifest",
7 |
8 | "viewingDirection": "left-to-right",
9 | "viewingHint": "paged",
10 | "startCanvas": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
11 |
12 | "sequences": [
13 | {
14 | "@type": "sc:Sequence",
15 | "label": "Current Order",
16 | "startCanvas": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
17 | "viewingHint": "paged",
18 | "viewingDirection": "right-to-left",
19 | "canvases": [
20 | {
21 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
22 | "@type": "sc:Canvas",
23 | "label": "Test 1 Canvas: 1",
24 | "height": 1800,
25 | "width": 1200,
26 | "images": [
27 | {
28 | "@type": "oa:Annotation",
29 | "motivation": "sc:painting",
30 | "resource": {
31 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/resources/page1-full.png",
32 | "@type": "dctypes:Image",
33 | "height": 1800,
34 | "width": 1200
35 | },
36 | "on": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json"
37 | }
38 | ]
39 | },
40 | {
41 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json",
42 | "@type": "sc:Canvas",
43 | "label": "Test 1 Canvas: 2",
44 | "height": 1800,
45 | "width": 1200,
46 | "images": [
47 | {
48 | "@type": "oa:Annotation",
49 | "motivation": "sc:painting",
50 | "resource": {
51 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/resources/page1-full.png",
52 | "@type": "dctypes:Image",
53 | "height": 1800,
54 | "width": 1200
55 | },
56 | "on": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json"
57 | }
58 | ]
59 | }
60 | ]
61 | },
62 | {
63 | "@type": "sc:Sequence",
64 | "label": "Another Order",
65 | "description": "This should actually be external, but for testing we inline it",
66 | "startCanvas": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
67 | "viewingHint": "continuous",
68 | "viewingDirection": "left-to-right",
69 | "canvases": [
70 | "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
71 | "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json"
72 | ]
73 | }
74 | ],
75 |
76 | "structures": [
77 | {
78 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1",
79 | "@type": "sc:Range",
80 | "label": "Top Range",
81 | "viewingHint": "top",
82 | "members": [
83 | {
84 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
85 | "@type": "sc:Canvas"
86 | },
87 | {
88 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1",
89 | "@type": "sc:Range"
90 | },
91 | {
92 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.2",
93 | "@type": "sc:Range"
94 | }
95 | ]
96 | },
97 | {
98 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1",
99 | "@type": "sc:Range",
100 | "label": "Intermediary Range",
101 | "ranges": [
102 | "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1.1"
103 | ]
104 | },
105 | {
106 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1.1",
107 | "@type": "sc:Range",
108 | "label": "Small Range",
109 | "canvases": [
110 | "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json#xywh=0,0,10,10"
111 | ]
112 | },
113 | {
114 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.2",
115 | "@type": "sc:Range",
116 | "label": "End Range",
117 | "canvases": [
118 | "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json"
119 | ]
120 | }
121 | ]
122 | }
--------------------------------------------------------------------------------
/tests/remote_cache/ghent.manifest.edu:
--------------------------------------------------------------------------------
1 | {"related":{"@id":"http://lib.ugent.be/viewer/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91","format":"text/html"},"license":"http://rightsstatements.org/vocab/UND/1.0/","@id":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91","sequences":[{"rendering":[{"@id":"https://lib.ugent.be/catalog/rug01%3A001484515/requests/new?objectid=archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91","format":"application/zip","label":"Download all images (562.38 MB)"}],"canvases":[{"attribution":"Provided by Ghent University Library","label":"1","@type":"sc:Canvas","thumbnail":{"@id":"http://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.1/0,0,6215,15076/226,/0/default.jpg","@type":"dctypes:Image"},"rendering":[{"label":"Download as jpeg2000 (78.77 MB)","format":"image/jp2","@id":"http://adore.ugent.be/OpenURL/resolve?rft_id=archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.1&svc_id=original"}],"license":"http://rightsstatements.org/vocab/UND/1.0/","width":6215,"height":15076,"images":[{"on":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/canvases/DS.1","@id":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/canvases/DS.1/image-annotations/0","@type":"oa:Annotation","motivation":"sc:painting","resource":{"width":6215,"label":"BHSL-PAP-000044_2010_0001_AC.jp2","height":15076,"@type":"dctypes:Image","format":"image/jpeg","@id":"http://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.1/full/full/0/native.jpg","service":{"profile":"http://iiif.io/api/image/2/level1.json","@context":"http://iiif.io/api/image/2/context.json","@id":"http://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.1"}}}],"@id":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/canvases/DS.1"},{"@id":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/canvases/DS.3","images":[{"resource":{"service":{"profile":"http://iiif.io/api/image/2/level1.json","@context":"http://iiif.io/api/image/2/context.json","@id":"http://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.3"},"@id":"http://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.3/full/full/0/native.jpg","format":"image/jpeg","@type":"dctypes:Image","height":15036,"label":"BHSL-PAP-000044_2010_0002_AC.jp2","width":6235},"motivation":"sc:painting","@type":"oa:Annotation","on":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/canvases/DS.3","@id":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/canvases/DS.3/image-annotations/0"}],"width":6235,"height":15036,"license":"http://rightsstatements.org/vocab/UND/1.0/","thumbnail":{"@type":"dctypes:Image","@id":"http://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.3/0,0,6235,15036/226,/0/default.jpg"},"rendering":[{"label":"Download as jpeg2000 (78.29 MB)","@id":"http://adore.ugent.be/OpenURL/resolve?rft_id=archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.3&svc_id=original","format":"image/jp2"}],"label":"2","@type":"sc:Canvas","attribution":"Provided by Ghent University Library"}],"@id":"http://adore.ugent.be/IIIF/manifests/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91/sequences/0","viewingDirection":"left-to-right","@type":"sc:Sequence"}],"metadata":[{"label":"Record","value":" https://lib.ugent.be/catalog/rug01%3A001484515/items/800000096237 "},{"label":"Title","value":"[papyrus] Document uit het archief van de dichter Dioskoros van Aphrodite (?)."},{"value":"34 regels ; 29 x 72,5 cm.","label":"Description"},{"label":"Description","value":"Papyrus"},{"value":"537-538?","label":"Publisher"},{"value":"BHSL.PAP.000044 Herkomst: Aphroditô","label":"Provenance"},{"label":"Contents","value":"Het document bevat een overeenkomst tussen een corporatie en haar leiders. De leden van de corporatie van jagers (en waarschijnlijk ook van vissers) gaan de verbintenis aan t.o.v. Flavius Hermauos en Flavius Dios, hen als hun chefs te erkennen voor de duu"},{"value":"archive.ugent.be:4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91","label":"Object ID"}],"attribution":"Provided by Ghent University Library","thumbnail":{"@id":"https://adore.ugent.be/IIIF/images/archive.ugent.be%3A4B39C8CA-6FF9-11E1-8C42-C8A93B7C8C91%3ADS.1/0,0,6215,15076/226,/0/default.jpg","@type":"dctypes:Image"},"within":[],"@context":"http://iiif.io/api/presentation/2/context.json","label":"Document uit het archief van de dichter Dioskoros van Aphrodite (?)[manuscript]","description":"Het document bevat een overeenkomst tussen een corporatie en haar leiders. De leden van de corporatie van jagers (en waarschijnlijk ook van vissers) gaan de verbintenis aan t.o.v. Flavius Hermauos en Flavius Dios, hen als hun chefs te erkennen voor de duu","@type":"sc:Manifest","seeAlso":{"dcterms:format":"application/marcxml+xml","@id":"https://lib.ugent.be/catalog/rug01%3A001484515.marcxml"},"logo":"http://adore.ugent.be/IIIF/img/logo_i.svg"}
--------------------------------------------------------------------------------
/tests/input_data/manifest-basic.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/1/manifest.json",
4 | "@type": "sc:Manifest",
5 | "label": "Manifest Label",
6 | "metadata": [{"label": "MD Label 1", "value": "MD Value 1"},
7 | {"label": "MD Label 2", "value": ["MD Value 2.1", "MD Value 2.2"]},
8 | {"label": "MD Label 3", "value": [
9 | {"@language": "en", "@value": "MD Value 3.en"},
10 | {"@language": "fr", "@value": "MD Value 3.fr"}
11 | ]}
12 | ],
13 | "description": "This is a description of the Manifest",
14 | "thumbnail": "http://iiif.io/img/logo-iiif-34x30.png",
15 |
16 | "viewingDirection": "left-to-right",
17 | "viewingHint": "paged",
18 | "navDate": "1900-01-01T00:00:00Z",
19 |
20 | "license": [
21 | "http://iiif.io/event/conduct/",
22 | "https://creativecommons.org/licenses/by/4.0/"
23 | ],
24 | "logo": "http://iiif.io/img/logo-iiif-34x30.png",
25 | "attribution": "Provided by Testing Organization",
26 |
27 | "startCanvas": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
28 |
29 | "seeAlso": {
30 | "@id": "http://example.org/description/record.xml",
31 | "format": "text/xml"
32 | },
33 | "rendering": [
34 | "http://example.org/docs/record.doc",
35 | {
36 | "@id": "http://example.org/docs/record.pdf",
37 | "format": "application/pdf"
38 | }
39 | ],
40 |
41 | "related": {
42 | "@id": "http://example.org/somewhere/foo.html",
43 | "format": "text/html"
44 | },
45 |
46 | "sequences": [
47 | {
48 | "@type": "sc:Sequence",
49 | "label": "Current Order",
50 | "startCanvas": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
51 | "viewingHint": "paged",
52 | "viewingDirection": "right-to-left",
53 | "canvases": [
54 | {
55 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
56 | "@type": "sc:Canvas",
57 | "label": "Test 1 Canvas: 1",
58 | "height": 1800,
59 | "width": 1200,
60 | "images": [
61 | {
62 | "@type": "oa:Annotation",
63 | "motivation": "sc:painting",
64 | "resource": {
65 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/resources/page1-full.png",
66 | "@type": "dctypes:Image",
67 | "height": 1800,
68 | "width": 1200
69 | },
70 | "on": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json"
71 | }
72 | ]
73 | },
74 | {
75 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json",
76 | "@type": "sc:Canvas",
77 | "label": "Test 1 Canvas: 2",
78 | "height": 1800,
79 | "width": 1200,
80 | "images": [
81 | {
82 | "@type": "oa:Annotation",
83 | "motivation": "sc:painting",
84 | "resource": {
85 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/resources/page1-full.png",
86 | "@type": "dctypes:Image",
87 | "height": 1800,
88 | "width": 1200
89 | },
90 | "on": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json"
91 | }
92 | ]
93 | }
94 |
95 |
96 | ]
97 | }
98 | ],
99 |
100 | "structures": [
101 | {
102 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1",
103 | "@type": "sc:Range",
104 | "label": "Top Range",
105 | "viewingHint": "top",
106 | "members": [
107 | {
108 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c1.json",
109 | "@type": "sc:Canvas"
110 | },
111 | {
112 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1",
113 | "@type": "sc:Range"
114 | },
115 | {
116 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.2",
117 | "@type": "sc:Range"
118 | }
119 | ]
120 | },
121 | {
122 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1",
123 | "@type": "sc:Range",
124 | "label": "Intermediary Range",
125 | "ranges": [
126 | "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1.1"
127 | ]
128 | },
129 | {
130 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.1.1",
131 | "@type": "sc:Range",
132 | "label": "Small Range",
133 | "canvases": [
134 | "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json#xywh=0,0,10,10"
135 | ]
136 | },
137 | {
138 | "@id": "http://iiif.io/api/presentation/2.1/example/fixtures/range/1.2",
139 | "@type": "sc:Range",
140 | "label": "End Range",
141 | "canvases": [
142 | "http://iiif.io/api/presentation/2.1/example/fixtures/canvas/1/c2.json"
143 | ]
144 | }
145 | ]
146 | }
--------------------------------------------------------------------------------
/twoToThreeUpgraderService.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # encoding: utf-8
3 | """IIIF Presentation Validation Service"""
4 |
5 | import argparse
6 | import json
7 | import os
8 | import sys
9 | try:
10 | # python3
11 | from urllib.request import urlopen, HTTPError
12 | from urllib.parse import urlparse
13 | except ImportError:
14 | # fall back to python2
15 | from urllib2 import urlopen, HTTPError
16 | from urlparse import urlparse
17 |
18 | from bottle import Bottle, abort, request, response, run, template
19 |
20 | #egg_cache = "/path/to/web/egg_cache"
21 | #os.environ['PYTHON_EGG_CACHE'] = egg_cache
22 |
23 | from iiif_prezi_upgrader import Upgrader
24 | from iiif_prezi_upgrader.prezi_upgrader import FLAGS
25 |
26 | class Service(object):
27 |
28 | def __init__(self):
29 | self.default_flags = {}
30 |
31 | def fetch(self, url):
32 | try:
33 | wh = urlopen(url)
34 | except HTTPError as wh:
35 | pass
36 | data = wh.read()
37 | wh.close()
38 | try:
39 | data = data.decode('utf-8')
40 | except:
41 | pass
42 | return (data, wh)
43 |
44 | def return_json(self, js):
45 | response.content_type = "application/ld+json;profile=\"http://iiif.io/api/presentation/3/context.json\""
46 | return json.dumps(js, indent=2)
47 |
48 | def do_upgrade(self, js, flags={}):
49 | up = Upgrader(flags=flags)
50 | results = up.process_resource(js, top=True)
51 | results = up.reorder(results)
52 | return self.return_json(results)
53 |
54 | def do_POST_upgrade(self):
55 | data = request.json
56 | if not data:
57 | b = request._get_body_string()
58 | try:
59 | b = b.decode('utf-8')
60 | except:
61 | pass
62 | data = json.loads(b)
63 | return self.do_upgrade(data)
64 |
65 | def do_GET_upgrade(self):
66 | url = request.query.get('url', '')
67 | url = url.strip()
68 | parsed_url = urlparse(url)
69 | if not parsed_url.scheme.startswith('http'):
70 | return self.return_json({'okay': 0, 'error': 'URLs must use HTTP or HTTPS', 'url': url})
71 | try:
72 | (data, webhandle) = self.fetch(url)
73 | except:
74 | return self.return_json({'okay': 0, 'error': 'Cannot fetch url', 'url': url})
75 |
76 | # catch if this is invalid JSON e.g. using a non IIIF resoruces like www.google.com
77 | try:
78 | data = json.loads(data)
79 | except Exception as error:
80 | return self.return_json({'okay': 0, 'error': 'Invalid JSON for supplied url.', 'url': url, 'json_error': str(error)})
81 |
82 | # And look for flags
83 | fs = FLAGS
84 | flags = {}
85 | for f in fs:
86 | if request.query.get(f, None):
87 | val = request.query[f]
88 | if val == "True":
89 | val = True
90 | elif val == "False":
91 | val = False
92 | flags[f] = val
93 |
94 | try:
95 | response = self.do_upgrade(data, flags)
96 | except Exception as e:
97 | response = {'okay': 0, 'error': "Error: %s" % e }
98 | return response
99 |
100 | def index_route(self):
101 | output = template('templates/index.tpl', flags=FLAGS)
102 | return output
103 |
104 | def dispatch_views(self):
105 | self.app.route("/", "GET", self.index_route)
106 | self.app.route("/upgrade", "OPTIONS", self.empty_response)
107 | self.app.route("/upgrade", "GET", self.do_GET_upgrade)
108 | self.app.route("/upgrade", "POST", self.do_POST_upgrade)
109 |
110 | def after_request(self):
111 | methods = 'GET,POST,OPTIONS'
112 | headers = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'
113 | response.headers['Access-Control-Allow-Origin'] = '*'
114 | response.headers['Access-Control-Allow-Methods'] = methods
115 | response.headers['Access-Control-Allow-Headers'] = headers
116 | response.headers['Allow'] = methods
117 |
118 | def empty_response(self, *args, **kwargs):
119 | """Empty response"""
120 |
121 | def get_bottle_app(self):
122 | """Returns bottle instance"""
123 | self.app = Bottle()
124 | self.dispatch_views()
125 | self.app.hook('after_request')(self.after_request)
126 | return self.app
127 |
128 | def main():
129 | parser = argparse.ArgumentParser(description=__doc__.strip(),
130 | formatter_class=argparse.ArgumentDefaultsHelpFormatter)
131 |
132 | parser.add_argument('--hostname', default='localhost',
133 | help='Hostname or IP address to bind to (use 0.0.0.0 for all)')
134 | parser.add_argument('--port', default=8080, type=int,
135 | help='Server port to bind to. Values below 1024 require root privileges.')
136 |
137 | args = parser.parse_args()
138 |
139 | s = Service()
140 | run(host=args.hostname, port=args.port, app=s.get_bottle_app())
141 |
142 | if __name__ == "__main__":
143 | main()
144 | else:
145 | s = Service()
146 | application = s.get_bottle_app()
147 |
--------------------------------------------------------------------------------
/tests/remote_cache/dublin.manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": "http://iiif.io/api/presentation/2/context.json",
3 | "@id": "https://data.ucd.ie/api/img/manifests/ucdlib:33064",
4 | "rendering": {
5 | "@id": "https://digital.ucd.ie/get/ucdlib:33064/content",
6 | "format": "application/pdf",
7 | "label": "Download as PDF"
8 | },
9 | "seeAlso": [
10 | {
11 | "@id": "https://digital.ucd.ie/view/ucdlib:33064.xml",
12 | "format": "text/xml",
13 | "profile": "http://www.loc.gov/mods/v3",
14 | "label": "MODS metadata describing this object"
15 | },
16 | {
17 | "@id": "https://digital.ucd.ie/view/ucdlib:33064.n3",
18 | "format": "text/rdf+n3",
19 | "label": "RDF n3 serialisation of metadata describing this object"
20 | },
21 | {
22 | "@id": "https://data.ucd.ie/api/edm/v1/ucdlib:33064",
23 | "format": "application/x.europeana-edm+xml",
24 | "label": "EDM (Europeana Data Model) RDF metadata",
25 | "profile": "http://www.europeana.eu/schemas/edm/"
26 | },
27 | {
28 | "@id": "https://digital.ucd.ie/view/ucdlib:33064.rdf",
29 | "format": "application/rdf+xml",
30 | "label": "RDF-XML metadata describing this object"
31 | } ],
32 | "within": {
33 | "@id": "https://data.ucd.ie/api/img/collection/ucdlib:33058",
34 |
35 | "@type": "sc:Collection",
36 |
37 | "label": "Dublin Town Planning Competition 1914"
38 | },
39 | "attribution": "Irish Architectural Archive",
40 | "logo": "https://digital.ucd.ie/images/logos/ucd_logo_sm.png",
41 | "description": "Drawing submitted by F.A. Cushing Smith to the town plan for Dublin international competition organised by the Civics Institute of Ireland in 1914. Cushing Smith was the sole US entrant and also one of only two single-person entrants. His address at the time of the competition was the University Club, Urbana, Illinois. To ensure anonymity during the adjudication process his entry was give the designation 'B'. Aside from the winners, the adjudicators were unanimous in giving Honourable Mention to four entries including Cushing Smith's. This drawing includes plans and elevations for various types of housing and a block plan of suburban house arrangements.",
42 | "label": "Housing Plans for Greater Dublin",
43 | "@type": "sc:Manifest",
44 | "thumbnail": "https://digital.ucd.ie/get/ucdlib:33064/thumbnail",
45 | "metadata": [
46 | { "label": "title","value": "Housing Plans for Greater Dublin" },
47 | {
48 | "label": "Type of resource", "value": [
49 | { "@value": "dctypes:StillImage" }
50 | ]
51 | },
52 | {
53 | "label": "published", "value": [
54 | {"@value": "Urbana, Ill."}
55 | ]
56 | },
57 | {
58 | "label": "created", "value": "1914"
59 | },
60 | {
61 | "label": "Exhibitions",
62 | "value": "A label included with the drawings indicates that Cushing Smith later exhibited the drawings in the Thirtieth Annual Chicago Architectural Exhibition, Art Institute of Chicago, 5-29 April, 1917."
63 | },
64 | {
65 | "label": "Ownership/custodial history",
66 | "value": "The drawings were donated to the Wilmette Historical Museum, Wilmette, Illinois by Cushing Smith's granddaughter, Mary Duke Smith, and daughter-in-law, Joan Smith. With the Smiths permission, Wilmette Historical Museum donated the drawings to the Irish Architectural Archive in 2011."
67 | },
68 | { "label" : "permalink", "value" : "doi:10.7925/drs1.ucdlib_33064" },
69 | {
70 | "label" : "topic-LCSH", "value":
71 | [
72 | { "@value": "City planning" },
73 | { "@value": "Architecture, Domestic" }
74 | ]
75 | },
76 | {
77 | "label": "genre", "value": "Competition drawings"
78 | },
79 | {
80 | "label": "genre", "value": "Architectural drawings"
81 | }
82 | ],
83 | "sequences": [{
84 | "@context":"http://iiif.io/api/presentation/2/context.json",
85 | "@id": "https://data.ucd.ie/api/img/manifests/ucdlib:33064/sequence/normal",
86 | "@type": "sc:Sequence",
87 |
88 | "label": "Current Page Order",
89 | "viewingHint": "individuals",
90 | "canvases": [
91 | {
92 | "@id": "https://data.ucd.ie/api/img/ucdlib:33064/canvas/ucdlib:33543",
93 | "@type": "sc:Canvas",
94 | "label": "recto",
95 | "width": 14451,
96 | "height": 14214,
97 | "service": { "@context": "http://iiif.io/api/annex/services/physdim/1/context.json", "profile": "http://iiif.io/api/annex/services/physdim",
98 | "physicalScale": 0.00333333333333333, "physicalUnits": "in" },
99 | "images": [{
100 | "resource": {
101 | "service": {
102 | "@id": "https://iiif.ucd.ie/loris/ucdlib:33543",
103 | "@context": "http://iiif.io/api/image/2/context.json",
104 | "profile": "http://iiif.io/api/image/2/level2.json"
105 | },
106 | "format": "image/jpeg",
107 | "height": 14214,
108 | "width": 14451,
109 | "@id": "https://iiif.ucd.ie/loris/ucdlib:33543/full/full/0/default.jpg",
110 | "@type": "dcTypes:Image"
111 | },
112 | "on": "https://data.ucd.ie/api/img/ucdlib:33064/canvas/ucdlib:33543",
113 | "motivation": "sc:painting",
114 | "@id": "https://data.ucd.ie/api/img/ucdlib:33064/annotation/ucdlib:33543",
115 | "@type": "oa:Annotation"
116 | }]
117 | }
118 | ]
119 | }]
120 | }
--------------------------------------------------------------------------------
/tests/remote_cache/harvard-art.manifest.json:
--------------------------------------------------------------------------------
1 | {"@context": "http://iiif.io/api/presentation/2/context.json", "@id": "https://iiif.harvardartmuseums.org/manifests/object/299843", "@type": "sc:Manifest", "attribution": "Harvard Art Museums", "description": "", "label": "Self-Portrait Dedicated to Paul Gauguin", "logo": "https://www.harvardartmuseums.org/assets/images/logo.png", "metadata": [{"label": "Date", "value": "1888"}, {"label": "Classification", "value": "Paintings"}, {"label": "Credit Line", "value": "Harvard Art Museums/Fogg Museum, Bequest from the Collection of Maurice Wertheim, Class of 1906"}, {"label": "Object Number", "value": "1951.65"}, {"label": "People", "value": ["Artist: Vincent van Gogh, Dutch, 1853 - 1890"]}, {"label": "Medium", "value": "Oil on canvas"}, {"label": "Dimensions", "value": "61.5 x 50.3 cm (24 3/16 x 19 13/16 in.)\r\nframed: 90.4 x 79.7 x 8.3 cm (35 9/16 x 31 3/8 x 3 1/4 in.)"}, {"label": "Provenance", "value": "Vincent van Gogh, Arles, (1888,) gift; to Paul Gauguin, (1888-1897) sold. [Ambroise Vollard, Paris.] [Paul Cassirer Gallery, Berlin.] Dr. Hugo von Tschudi, Berlin, (1906-1911), by descent; to his widow, Angela von Tschudi, Munich (1911-1919), to Neue Staatsgalerie, Munich (1919-1938); removed from the collection by the National Socialist (Nazi) authorities in 1938, consigned; to [Theodor Fischer Gallery, Lucerne, Switzerland, for sale June 30, 1939, lot 45]; to Maurice Wertheim (1939-1951) bequest; to Fogg Art Museum, 1951.\r\n\r\n \r\n\r\nNotes:\r\nGauguin sold the painting for Fr 300\r\nHugo von Tschudi bought the painting for the Nationalgalerie, Berlin, with funds from sponsors, but did not submit it to the Kaiser for pre-approval. He took the painting to Munich when he assumed a post there.\r\nAccording to Stephanie Barron, the van Gogh was removed from the Neue Staatsgalerie on March 27, 1938 and stored at Schloss Niedersch\u00f6nhausen in August of that year. (Barron, 1990,pp. 135-146)\r\n"}], "rendering": {"@id": "https://www.harvardartmuseums.org/collections/object/299843", "format": "text/html", "label": "Full record view"}, "sequences": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/sequence/normal", "@type": "sc:Sequence", "canvases": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896", "@type": "sc:Canvas", "height": 2550, "images": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/annotation/anno-47174896", "@type": "oa:Annotation", "motivation": "sc:painting", "on": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896", "resource": {"@id": "https://ids.lib.harvard.edu/ids/iiif/47174896/full/full/0/native.jpg", "@type": "dctypes:Image", "format": "image/jpeg", "height": 2550, "service": {"@context": "http://iiif.io/api/image/1/context.json", "@id": "https://ids.lib.harvard.edu/ids/iiif/47174896", "profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"}, "width": 2087}}], "label": "1", "width": 2087}, {"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-18737483", "@type": "sc:Canvas", "height": 2550, "images": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/annotation/anno-18737483", "@type": "oa:Annotation", "motivation": "sc:painting", "on": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-18737483", "resource": {"@id": "https://ids.lib.harvard.edu/ids/iiif/18737483/full/full/0/native.jpg", "@type": "dctypes:Image", "format": "image/jpeg", "height": 2550, "service": {"@context": "http://iiif.io/api/image/1/context.json", "@id": "https://ids.lib.harvard.edu/ids/iiif/18737483", "profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"}, "width": 2088}}], "label": "2", "width": 2088}, {"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174892", "@type": "sc:Canvas", "height": 2550, "images": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/annotation/anno-47174892", "@type": "oa:Annotation", "motivation": "sc:painting", "on": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174892", "resource": {"@id": "https://ids.lib.harvard.edu/ids/iiif/47174892/full/full/0/native.jpg", "@type": "dctypes:Image", "format": "image/jpeg", "height": 2550, "service": {"@context": "http://iiif.io/api/image/1/context.json", "@id": "https://ids.lib.harvard.edu/ids/iiif/47174892", "profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"}, "width": 2259}}], "label": "3", "width": 2259}, {"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-43182083", "@type": "sc:Canvas", "height": 2550, "images": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/annotation/anno-43182083", "@type": "oa:Annotation", "motivation": "sc:painting", "on": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-43182083", "resource": {"@id": "https://ids.lib.harvard.edu/ids/iiif/43182083/full/full/0/native.jpg", "@type": "dctypes:Image", "format": "image/jpeg", "height": 2550, "service": {"@context": "http://iiif.io/api/image/1/context.json", "@id": "https://ids.lib.harvard.edu/ids/iiif/43182083", "profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"}, "width": 2100}}], "label": "4", "width": 2100}, {"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-43183405", "@type": "sc:Canvas", "height": 2550, "images": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/annotation/anno-43183405", "@type": "oa:Annotation", "motivation": "sc:painting", "on": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-43183405", "resource": {"@id": "https://ids.lib.harvard.edu/ids/iiif/43183405/full/full/0/native.jpg", "@type": "dctypes:Image", "format": "image/jpeg", "height": 2550, "service": {"@context": "http://iiif.io/api/image/1/context.json", "@id": "https://ids.lib.harvard.edu/ids/iiif/43183405", "profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"}, "width": 2082}}], "label": "5", "width": 2082}, {"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-43183422", "@type": "sc:Canvas", "height": 2550, "images": [{"@id": "https://iiif.harvardartmuseums.org/manifests/object/299843/annotation/anno-43183422", "@type": "oa:Annotation", "motivation": "sc:painting", "on": "https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-43183422", "resource": {"@id": "https://ids.lib.harvard.edu/ids/iiif/43183422/full/full/0/native.jpg", "@type": "dctypes:Image", "format": "image/jpeg", "height": 2550, "service": {"@context": "http://iiif.io/api/image/1/context.json", "@id": "https://ids.lib.harvard.edu/ids/iiif/43183422", "profile": "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"}, "width": 2093}}], "label": "6", "width": 2093}], "viewingHint": "individuals"}], "within": "https://www.harvardartmuseums.org/collections"}
--------------------------------------------------------------------------------
/tests/remote_cache/ycba.manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "@type" : "sc:Manifest",
3 | "@context" : "http://iiif.io/api/presentation/2/context.json",
4 | "@id" : "https://manifests.britishart.yale.edu/manifest/1474",
5 | "label" : "Peter Gaspar Scheemakers, 1691–1781, Flemish, active in Britain (from ca. 1720), Alexander Pope, ca. 1740, Marble, Yale Center for British Art, B1977.14.29, Paintings and Sculpture",
6 | "description" : "Overall: 27 x 18 x 9 inches (68.6 x 45.7 x 22.9 cm), Chiseled on front of socle: \"POPE.\"",
7 | "attribution" : "Yale Center for British Art, Paul Mellon Collection, Public Domain ",
8 | "metadata" : [ {
9 | "label" : "Creator(s)",
10 | "value" : [ "Peter Gaspar Scheemakers, 1691–1781, Flemish, active in Britain (from ca. 1720)" ]
11 | }, {
12 | "label" : "Titles",
13 | "value" : [ "Alexander Pope " ]
14 | }, {
15 | "label" : "Date",
16 | "value" : [ "ca. 1740" ]
17 | }, {
18 | "label" : "Medium",
19 | "value" : [ "Marble " ]
20 | }, {
21 | "label" : "Dimensions",
22 | "value" : [ "Overall: 27 x 18 x 9 inches (68.6 x 45.7 x 22.9 cm)" ]
23 | }, {
24 | "label" : "Inscriptions",
25 | "value" : [ "Chiseled on front of socle: \"POPE.\" " ]
26 | }, {
27 | "label" : "Credit line",
28 | "value" : [ "Yale Center for British Art, Paul Mellon Collection" ]
29 | }, {
30 | "label" : "Institution",
31 | "value" : [ "Yale Center for British Art" ]
32 | }, {
33 | "label" : "Collection",
34 | "value" : [ "Paintings and Sculpture" ]
35 | }, {
36 | "label" : "Accession number",
37 | "value" : [ "B1977.14.29" ]
38 | }, {
39 | "label" : "Bibliography",
40 | "value" : [ "Prof. Maynard Mack, The World of Alexander Pope, Yale University Press, New Haven, no. 20, Z8704 M37 ", "Malcolm Baker, Literary Figures, Apollo, 179, June 2014, p. 76, N1 A54+ 179:2 " ]
41 | } ],
42 | "logo" : "https://static.britishart.yale.edu/images/ycba_logo.jpg",
43 | "related" : [ {
44 | "@id" : "http://collections.britishart.yale.edu/vufind/Record/1666375",
45 | "label" : "catalog entry at the Yale Center for British Art",
46 | "format" : "text/html"
47 | } ],
48 | "seeAlso" : [ {
49 | "@id" : "https://manifests.britishart.yale.edu/xml/1474.xml",
50 | "format" : "text/xml",
51 | "profile" : "http://www.lido-schema.org/schema/v1.0/lido-v1.0.xsd"
52 | }, {
53 | "@id" : "http://collection.britishart.yale.edu/id/data/object/1474",
54 | "format" : "text/rdf+n3"
55 | } ],
56 | "sequences" : [ {
57 | "@id" : "https://manifests.britishart.yale.edu/sequence/1474",
58 | "@type" : "sc:Sequence",
59 | "label" : "default sequence",
60 | "viewingHint" : "individuals",
61 | "canvases" : [ {
62 | "images" : [ {
63 | "resource" : {
64 | "@type" : "dctypes:Image",
65 | "service" : {
66 | "profile" : "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",
67 | "@id" : "https://images.britishart.yale.edu/iiif/1778fd7f-0dd6-4229-b667-fb682255a8f1",
68 | "@context" : "http://iiif.io/api/image/1/context.json"
69 | },
70 | "format" : "image/jpeg",
71 | "width" : 6127,
72 | "@id" : "https://images.britishart.yale.edu/iiif/1778fd7f-0dd6-4229-b667-fb682255a8f1/full/full/0/native.jpg",
73 | "label" : "front",
74 | "height" : 8173
75 | },
76 | "@type" : "oa:Annotation",
77 | "motivation" : "sc:painting",
78 | "@id" : "https://manifests.britishart.yale.edu/annotation/ba-obj-1474-0001-pub",
79 | "on" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0001-pub"
80 | } ],
81 | "@type" : "sc:Canvas",
82 | "width" : 6127,
83 | "@id" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0001-pub",
84 | "label" : "front",
85 | "height" : 8173
86 | }, {
87 | "images" : [ {
88 | "resource" : {
89 | "@type" : "dctypes:Image",
90 | "service" : {
91 | "profile" : "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",
92 | "@id" : "https://images.britishart.yale.edu/iiif/915ba5d3-e38a-4d3c-a81a-ca858dc5cdb6",
93 | "@context" : "http://iiif.io/api/image/1/context.json"
94 | },
95 | "format" : "image/jpeg",
96 | "width" : 6127,
97 | "@id" : "https://images.britishart.yale.edu/iiif/915ba5d3-e38a-4d3c-a81a-ca858dc5cdb6/full/full/0/native.jpg",
98 | "label" : "front",
99 | "height" : 8955
100 | },
101 | "@type" : "oa:Annotation",
102 | "motivation" : "sc:painting",
103 | "@id" : "https://manifests.britishart.yale.edu/annotation/ba-obj-1474-0001-bar",
104 | "on" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0001-bar"
105 | } ],
106 | "@type" : "sc:Canvas",
107 | "width" : 6127,
108 | "@id" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0001-bar",
109 | "label" : "front",
110 | "height" : 8955
111 | }, {
112 | "images" : [ {
113 | "resource" : {
114 | "@type" : "dctypes:Image",
115 | "service" : {
116 | "profile" : "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",
117 | "@id" : "https://images.britishart.yale.edu/iiif/2057e87a-de16-4e59-ba15-3bcdaae7d8b0",
118 | "@context" : "http://iiif.io/api/image/1/context.json"
119 | },
120 | "format" : "image/jpeg",
121 | "width" : 6127,
122 | "@id" : "https://images.britishart.yale.edu/iiif/2057e87a-de16-4e59-ba15-3bcdaae7d8b0/full/full/0/native.jpg",
123 | "label" : "proper left",
124 | "height" : 8173
125 | },
126 | "@type" : "oa:Annotation",
127 | "motivation" : "sc:painting",
128 | "@id" : "https://manifests.britishart.yale.edu/annotation/ba-obj-1474-0002-pub",
129 | "on" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0002-pub"
130 | } ],
131 | "@type" : "sc:Canvas",
132 | "width" : 6127,
133 | "@id" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0002-pub",
134 | "label" : "proper left",
135 | "height" : 8173
136 | }, {
137 | "images" : [ {
138 | "resource" : {
139 | "@type" : "dctypes:Image",
140 | "service" : {
141 | "profile" : "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",
142 | "@id" : "https://images.britishart.yale.edu/iiif/4c630d19-d059-40ca-ba8c-0646bec2ab13",
143 | "@context" : "http://iiif.io/api/image/1/context.json"
144 | },
145 | "format" : "image/jpeg",
146 | "width" : 6127,
147 | "@id" : "https://images.britishart.yale.edu/iiif/4c630d19-d059-40ca-ba8c-0646bec2ab13/full/full/0/native.jpg",
148 | "label" : "back",
149 | "height" : 8173
150 | },
151 | "@type" : "oa:Annotation",
152 | "motivation" : "sc:painting",
153 | "@id" : "https://manifests.britishart.yale.edu/annotation/ba-obj-1474-0003-pub",
154 | "on" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0003-pub"
155 | } ],
156 | "@type" : "sc:Canvas",
157 | "width" : 6127,
158 | "@id" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0003-pub",
159 | "label" : "back",
160 | "height" : 8173
161 | }, {
162 | "images" : [ {
163 | "resource" : {
164 | "@type" : "dctypes:Image",
165 | "service" : {
166 | "profile" : "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1",
167 | "@id" : "https://images.britishart.yale.edu/iiif/0d02621e-57b7-46c8-9674-2c1e419b8b91",
168 | "@context" : "http://iiif.io/api/image/1/context.json"
169 | },
170 | "format" : "image/jpeg",
171 | "width" : 6127,
172 | "@id" : "https://images.britishart.yale.edu/iiif/0d02621e-57b7-46c8-9674-2c1e419b8b91/full/full/0/native.jpg",
173 | "label" : "proper right",
174 | "height" : 8173
175 | },
176 | "@type" : "oa:Annotation",
177 | "motivation" : "sc:painting",
178 | "@id" : "https://manifests.britishart.yale.edu/annotation/ba-obj-1474-0004-pub",
179 | "on" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0004-pub"
180 | } ],
181 | "@type" : "sc:Canvas",
182 | "width" : 6127,
183 | "@id" : "https://manifests.britishart.yale.edu/canvas/ba-obj-1474-0004-pub",
184 | "label" : "proper right",
185 | "height" : 8173
186 | } ]
187 | } ]
188 | }
--------------------------------------------------------------------------------
/templates/index.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Presentation API 2 to 3 converter — IIIF | International Image Interoperability Framework
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
60 |
61 |
62 |
63 |
66 |
67 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
Prezi 2 to 3 Converter
88 |
89 |
90 |
91 |
92 | This service will convert a version 2.0 or 2.1 Manifest to version 3.0. Fill in the URL of your manifest, and it will provide a converted 3.0 Manifest.
93 |
94 |
95 |
133 |
134 |
135 |
136 |
137 |
Technical Note
138 |
139 | If you would like to use the converter programatically, there are two options:
140 |
141 |
142 | Download the code from github and run it locally.
143 | Use it online with JSON based output, by an HTTP GET to this endpoint: http://<url_to_be_determined>;url=manifest-url-here
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
160 |
161 |
195 |
204 |
205 |
206 |