Skip to content

Commit

Permalink
Add aif, m4a, mp4 audio
Browse files Browse the repository at this point in the history
  • Loading branch information
hadro committed Jul 25, 2023
1 parent 7e7854b commit 39dff59
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def to_mimetype(format):
"h.264 MPEG4": "video/mpeg",
"h.264": "video/mpeg",
"Matroska": "video/x-matroska",
"Cinepack": "video/x-msvideo"
"Cinepack": "video/x-msvideo",
"AIFF": "audio/aiff",
"Apple Lossless Audio": "audio/x-m4a",
"MPEG-4 Audio": "audio/mp4"
}
return formats.get(format, "application/octet-stream")

Expand Down Expand Up @@ -388,7 +391,7 @@ def create_manifest3(identifier, domain=None, page=None):
originals.append(f)

# create the canvases for each original
for file in [f for f in originals if f['format'] in ['VBR MP3', '32Kbps MP3', '56Kbps MP3', '64Kbps MP3', '96Kbps MP3', '128Kbps MP3', 'Flac', 'Ogg Vorbis', 'WAVE', '24bit Flac', 'Shorten']]:
for file in [f for f in originals if f['format'] in ['VBR MP3', '32Kbps MP3', '56Kbps MP3', '64Kbps MP3', '96Kbps MP3', '128Kbps MP3', 'MPEG-4 Audio', 'Flac', 'AIFF', 'Apple Lossless Audio', 'Ogg Vorbis', 'WAVE', '24bit Flac', 'Shorten']]:
normalised_id = file['name'].rsplit(".", 1)[0]
slugged_id = normalised_id.replace(" ", "-")
c_id = f"https://iiif.archivelab.org/iiif/{identifier}/{slugged_id}/canvas"
Expand All @@ -402,7 +405,7 @@ def create_manifest3(identifier, domain=None, page=None):
if file['name'] in derivatives:
body = Choice(items=[])
# add the choices in order per https://github.com/ArchiveLabs/iiif.archivelab.org/issues/77#issuecomment-1499672734
for format in ['VBR MP3', '32Kbps MP3', '56Kbps MP3', '64Kbps MP3', '96Kbps MP3', '128Kbps MP3', 'Flac', 'Ogg Vorbis', 'WAVE', '24bit Flac', 'Shorten']:
for format in ['VBR MP3', '32Kbps MP3', '56Kbps MP3', '64Kbps MP3', '96Kbps MP3', '128Kbps MP3', 'MPEG-4 Audio', 'Flac', 'AIFF', 'Apple Lossless Audio', 'Ogg Vorbis', 'WAVE', '24bit Flac', 'Shorten']:
if format in derivatives[file['name']]:
r = ResourceItem(id=f"https://archive.org/download/{identifier}/{derivatives[file['name']][format]['name'].replace(' ', '%20')}",
type='Audio',
Expand Down

0 comments on commit 39dff59

Please sign in to comment.