Skip to content

Commit

Permalink
Put logic in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
hadro committed Oct 11, 2023
1 parent 1dc132b commit 728ba62
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,25 @@ def create_manifest3(identifier, domain=None, page=None):
# id=f"https://iiif.archivelab.org/iiif/{identifier}${pageCount}/canvas",
# label=f"{page['leafNum']}")
pageCount += 1


# Setting logic for paging behavior and starting canvases
# Start with paged (default) or individual behaviors
try:
if bookreader['data']['brOptions']['defaults'] == "mode/1up":
manifest.behavior = "individuals"
except:
manifest.behavior = "paged"

# Then set left-to-right or right-to-left if present
if bookreader['data']['brOptions']['pageProgression'] == "lr":
viewingDirection = "left-to-right"
elif bookreader['data']['brOptions']['pageProgression'] == "rl":
viewingDirection = "right-to-left"
if viewingDirection:
manifest.viewingDirection = viewingDirection


elif mediatype == 'image':
singleImage(metadata, identifier, manifest, uri)
elif mediatype == 'audio' or mediatype == 'etree':
Expand Down Expand Up @@ -442,23 +461,6 @@ def create_manifest3(identifier, domain=None, page=None):
c.add_item(ap)
manifest.add_item(c)

# Setting logic for paging behavior and starting canvases
# Start with paged (default) or individual behaviors
try:
if bookreader['data']['brOptions']['defaults'] == "mode/1up":
manifest.behavior = "individuals"
except:
manifest.behavior = "paged"

# Then set left-to-right or right-to-left if present
if bookreader['data']['brOptions']['pageProgression'] == "lr":
viewingDirection = "left-to-right"
elif bookreader['data']['brOptions']['pageProgression'] == "rl":
viewingDirection = "right-to-left"
if viewingDirection:
manifest.viewingDirection = viewingDirection


elif mediatype == "movies":
# sort the files into originals and derivatives, splitting the derivatives into buckets based on the original
originals = []
Expand Down

0 comments on commit 728ba62

Please sign in to comment.