Libraries to upgrade IIIF Presentation API manifest from v2 to v3 automatically
There are three options on how to use this program either through Docker, installed locally or programatically. Details below:
Build the docker image:
docker build -t prezi-2-to-3 .
Run the image:
docker run -it --rm -p 8000:80 --name upgrader prezi-2-to-3:latest
or run both with the following command:
docker build -t prezi-2-to-3 . && docker run -it --rm -p 8000:80 --name upgrader prezi-2-to-3:latest
Then navigating to the following page: http://localhost:8000.
sudo python setup.py install
You can then either run a web version or run it from the command line.
Usage:
python prezi2to3.py
Usage:
python prezi2to3.py [file_path or url to manifest] [optional output file name]
Examples:
# Convert manifest from filesystem and print results to screen
python prezi2to3.py tests/input_data/manifest-services.json
# Convert remote manfiest and save results to /tmp/upgraded.json
python prezi2to3.py http://iiif.io/api/presentation/2.1/example/fixtures/1/manifest.json /tmp/upgraded.json
To run the web version:
./twoToThreeUpgraderService.py --port 8000
and navigate to http://localhost:8000. Note the default port if not specified is 8080.
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.
from iiif_prezi_upgrader import Upgrader
upgrader = Upgrader(flags={"flag_name" : "flag_value"}) # create an upgrader
v3 = upgrader.process_cached("/path/to/iiif/v2/file.json")
v3 = upgrader.process_uri("http://example.org/iiif/v2/file.json")
v3 = upgrader.process_resource(json, top=True)
desc_2_md
: Thedescription
property is not a summary, and hence should be put in as ametadata
pair. The label generated will be "Description". The default isTrue
.related_2_md
: Therelated
property is not a homepage, and hence should be put in as ametadata
pair. The label generated will be "Related". The default isFalse
(and hence the property will simply be renamed ashomepage
)ext_ok
: Should extensions be copied through to the new version. The default isFalse
.default_lang
: The default language to use for language maps. The default is "@none".deref_links
: Should links without aformat
property be dereferenced and the HTTP response inspected for the media type? The default isTrue
.debug
: Are we in debug mode and should spit out more warnings than normal? The default isFalse
- 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.
- 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.
- Are PRs welcome? Yes :)