Skip to content

Commit

Permalink
Adding support for audio items with no derivatives
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Feb 6, 2025
1 parent 704649e commit 2068f13
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,12 @@ def create_manifest3(identifier, domain=None, page=None):
body.items.append(r)
else:
# todo: deal with instances where there are no derivatives for whatever reason
pass
body = ResourceItem(
id=f"https://archive.org/download/{identifier}/{file['name'].replace(' ', '%20')}",
type='Sound',
format=to_mimetype(file['format']),
label={"none": [file['format']]},
duration=float(file['length']))

anno.body = body
ap.add_item(anno)
Expand Down
19 changes: 19 additions & 0 deletions tests/test_audio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os

import unittest
import math
from flask.testing import FlaskClient
from iiify.app import app

class TestAudio(unittest.TestCase):

def setUp(self) -> None:
os.environ["FLASK_CACHE_DISABLE"] = "true"
self.test_app = FlaskClient(app)

def test_audio_no_derivatives(self):
resp = self.test_app.get("/iiif/3/kaled_jalil/manifest.json")
self.assertEqual(resp.status_code, 200)
manifest = resp.json

self.assertEqual(len(manifest['items']),114,f"Expected 114 canvases but got: {len(manifest['items'])}")

0 comments on commit 2068f13

Please sign in to comment.