Skip to content

Commit

Permalink
Add first pass at thumbnails for audio
Browse files Browse the repository at this point in the history
  • Loading branch information
hadro committed Aug 10, 2023
1 parent eda9438 commit 21680a0
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,30 +418,26 @@ def create_manifest3(identifier, domain=None, page=None):

c_id = f"{URI_PRIFIX}/{identifier}/{slugged_id}/canvas"

# Add thumbnail as image service
for t in valid_filetypes:
thumb = file['name'].rsplit(".")[0]+"."+t
if thumb in str(metadata['files']):
# Add thumbnail
for t, ext in enumerate(['png', 'jpeg', 'jpg']):
thumb = file['name'].rsplit('.', maxsplit=1)[0]+"."+ext
if t == 0:
format = "image/png"
else:
format = "image/jpeg"

if thumb.lower() in str(metadata['files']).lower():

imgId = f"{identifier}/{quote(thumb)}".replace('/','%2F')
imgURL = f"{IMG_SRV}/3/{imgId}"
imgId = quote(f"{identifier}/{thumb}")

thumbnail = ResourceItem(id=f"{imgURL}/full/max/0/default.jpg",
thumbnail = ResourceItem(id=f"https://archive.org/download/{imgId}",
type="Image",
format="image/jpeg",
#height=300,
#width=221
format=f"{format}",
)
thumbnail.make_service(id=f"{imgURL}",
type="ImageService3",
profile="level2")
thumbnail = [thumbnail]
else:
pass




try:
c = Canvas(id=c_id, label=normalised_id, duration=float(file['length']), thumbnail=thumbnail)
except:
Expand Down

0 comments on commit 21680a0

Please sign in to comment.