-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from markpbaggett/recipe_0047
Add recipe for 0047 Homepage.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Linking to Web Page of an Object | ||
| | **Cookbook URLs** | | ||
|--------------|-------------------| | ||
| **Recipe:** | [https://iiif.io/api/cookbook/recipe/0047-homepage/](https://iiif.io/api/cookbook/recipe/0047-homepage/) | | ||
| **JSON-LD:** | [https://iiif.io/api/cookbook/recipe/0047-homepage/manifest.json](https://iiif.io/api/cookbook/recipe/0047-homepage/manifest.json) | | ||
|
||
### Method 1 - Add Homepage as HomepageItem | ||
```python | ||
--8<-- "docs/recipes/scripts/0047-homepage-method1.py" | ||
``` |
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,46 @@ | ||
from iiif_prezi3 import Manifest, ResourceItem, AnnotationPage, Annotation, config, HomepageItem | ||
|
||
config.configs['helpers.auto_fields.AutoLang'].auto_lang = "none" | ||
base_url = "https://iiif.io/api/cookbook/recipe/0047-homepage" | ||
|
||
homepage = HomepageItem( | ||
id="https://www.getty.edu/art/collection/object/103RQQ", | ||
type="Text", | ||
label={"en": ["Home page at the Getty Museum Collection"]}, | ||
format="text/html", | ||
language="en", | ||
) | ||
manifest = Manifest( | ||
id=f"{base_url}/manifest.json", | ||
label="Laocöon", | ||
homepage=homepage, | ||
) | ||
canvas = manifest.make_canvas( | ||
id=f"{base_url}/canvas/1", | ||
label="Front" | ||
) | ||
anno_body = ResourceItem( | ||
id="https://iiif.io/api/image/3.0/example/reference/28473c77da3deebe4375c3a50572d9d3-laocoon/full/!500,500/0/default.jpg", | ||
type="Image", | ||
format="image/jpeg" | ||
) | ||
anno_body.make_service( | ||
id="https://iiif.io/api/image/3.0/example/reference/28473c77da3deebe4375c3a50572d9d3-laocoon", | ||
type="ImageService3", | ||
profile="level1" | ||
) | ||
anno_page = AnnotationPage( | ||
id=f"{base_url}/canvas/1/page/1" | ||
) | ||
hw = {"height": 3000, "width": 2315} | ||
anno_body.set_hwd(**hw) | ||
canvas.set_hwd(**hw) | ||
anno = Annotation( | ||
id=f"{base_url}/canvas/1/page/1/annotation/1", | ||
motivation="painting", | ||
body=anno_body, | ||
target=canvas.id | ||
) | ||
anno_page.add_item(anno) | ||
canvas.add_item(anno_page) | ||
print(manifest.json(indent=2)) |