Skip to content

Commit

Permalink
Use base_url.
Browse files Browse the repository at this point in the history
  • Loading branch information
markpbaggett committed Dec 6, 2024
1 parent 0717dba commit 3e7c967
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions docs/recipes/scripts/0219-using-caption-file-method1.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
from iiif_prezi3 import Manifest, ResourceItem, AnnotationPage, Annotation, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"
base_url = "https://iiif.io/api/cookbook/recipe/0219-using-caption-file"

manifest = Manifest(
id="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/manifest.json",
id=f"{base_url}/manifest.json",
label="Lunchroom Manners"
)
canvas = manifest.make_canvas(id="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas")
canvas = manifest.make_canvas(id=f"{base_url}/canvas")
painting_anno_body = ResourceItem(
id="https://fixtures.iiif.io/video/indiana/lunchroom_manners/high/lunchroom_manners_1024kb.mp4",
type="Video",
format="video/mp4"
)
painting_anno_page = AnnotationPage(
id="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page"
id=f"{base_url}/canvas/page"
)
painting_anno = Annotation(
id="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page/annotation1",
id=f"{base_url}/canvas/page/annotation1",
motivation="painting",
body=painting_anno_body,
target=canvas.id
Expand All @@ -26,7 +28,7 @@
painting_anno_page.add_item(painting_anno)
canvas.add_item(painting_anno_page)
captions = canvas.make_annotation(
id="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page2/a1",
id=f"{base_url}/canvas/page2/a1",
motivation="supplementing",
body={
"id": "https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt",
Expand All @@ -39,7 +41,7 @@
]
}
},
target="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas",
anno_page_id="https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page2"
target=f"{base_url}/canvas",
anno_page_id=f"{base_url}/canvas/page2"
)
print(manifest.json(indent=2))

0 comments on commit 3e7c967

Please sign in to comment.