Skip to content

Commit

Permalink
Merge pull request #103 from internetarchive/issue_101
Browse files Browse the repository at this point in the history
Addressing Issue 101.
  • Loading branch information
glenrobson authored Feb 21, 2025
2 parents bb10482 + 0e01aee commit 5058046
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 65 deletions.
6 changes: 3 additions & 3 deletions iiify/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ def collection3page(identifier, page):
@cache.cached(timeout=cache_timeouts["long"], forced_update=cache_bust)
def collectionJSON(identifier):
validate_ia_identifier(identifier, page_suffix=False)
return redirect(f'/iiif/3/{identifier}/collection.json', code=302)
return collection3JSON(identifier)


@app.route('/iiif/<identifier>/<page>/collection.json')
@cache.cached(timeout=cache_timeouts["long"], forced_update=cache_bust)
def collectionPage(identifier, page):
validate_ia_identifier(identifier, page_suffix=False)
return redirect(f'/iiif/3/{identifier}/{page}/collection.json', code=302)
return collection3page(identifier, page)


@app.route('/iiif/3/<identifier>/manifest.json')
Expand Down Expand Up @@ -219,7 +219,7 @@ def vtt_stream(identifier):
@cache.cached(timeout=cache_timeouts["long"], forced_update=cache_bust)
def manifest(identifier):
validate_ia_identifier(identifier, page_suffix=False)
return redirect(f'/iiif/3/{identifier}/manifest.json', code=302)
return manifest3(identifier)

@app.route('/iiif/2/<identifier>/manifest.json')
def manifest2(identifier):
Expand Down
2 changes: 1 addition & 1 deletion iiify/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def create_manifest(identifier, domain=None, page=None):

manifest = {
'@context': PRZ_CTX,
'@id': '%s%s/manifest.json' % (domain, identifier),
'@id': '%s2/%s/manifest.json' % (domain,identifier),
'@type': 'sc:Manifest',
'description': metadata.get('description', ''),
'logo': 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcReMN4l9cgu_qb1OwflFeyfHcjp8aUfVNSJ9ynk2IfuHwW1I4mDSw',
Expand Down
12 changes: 6 additions & 6 deletions iiify/templates/docs/collections.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ <h4>Example</h4>
<pre>leedsuniversitylibrary</pre>

<p>To then get the IIIF collection manifest, plug in the ID to the following template:</p>
<div class="request">https://iiif.archive.org/iiif/3/<b>:id</b>/collection.json</div>
<div class="request">https://iiif.archive.org/iiif/<b>:id</b>/collection.json</div>

<p>For the Leeds example above, the final IIIF collection manifest URL would be:</p>
<div class="request">https://iiif.archive.org/iiif/3/leedsuniversitylibrary/collection.json</div>
<div class="request">https://iiif.archive.org/iiif/leedsuniversitylibrary/collection.json</div>

<h3>Note about nested collections</h3>
<p>Please note that Internet Archive collections can be arbitrarily nested within other collections. In these cases, the IIIF collection manifest will return a link to one or more IIIF collection manifest(s) in addition to the items nested individually within that Internet Archive collection.</p>
Expand All @@ -34,10 +34,10 @@ <h2><a name="resources-listing">Pagination for large collections</a></h2>

<table>
<thead><td>Collection manifest URL</td><td>Items retrieved</td></thead>
<tr><td>https://iiif.archive.org/iiif/3/leedsuniversitylibrary/collection.json</td><td>0-999</td></tr>
<tr><td>https://iiif.archive.org/iiif/3/leedsuniversitylibrary/2/collection.json</td><td>1000-1999</td></tr>
<tr><td>https://iiif.archive.org/iiif/3/leedsuniversitylibrary/3/collection.json</td><td>2000-2999</td></tr>
<tr><td>https://iiif.archive.org/iiif/3/leedsuniversitylibrary/4/collection.json</td><td>3000-3775</td></tr>
<tr><td>https://iiif.archive.org/iiif/leedsuniversitylibrary/collection.json</td><td>0-999</td></tr>
<tr><td>https://iiif.archive.org/iiif/leedsuniversitylibrary/2/collection.json</td><td>1000-1999</td></tr>
<tr><td>https://iiif.archive.org/iiif/leedsuniversitylibrary/3/collection.json</td><td>2000-2999</td></tr>
<tr><td>https://iiif.archive.org/iiif/leedsuniversitylibrary/4/collection.json</td><td>3000-3775</td></tr>
</table>
</section>
</article>
Expand Down
4 changes: 2 additions & 2 deletions iiify/templates/docs/items.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ <h4>Example</h4>
<p>So, from our example just above, the Internet Archive identifier for that item is: <pre>img-8664_202009</pre></p>

<p>To then get the IIIF manifest, plug in the ID to the following template:</p>
<div class="request">https://iiif.archive.org/iiif/3/<b>:id</b>/manifest.json</div>
<div class="request">https://iiif.archive.org/iiif/<b>:id</b>/manifest.json</div>

<p>For the example above, the final IIIF manifest URL would be:</p>
<div class="request">https://iiif.archive.org/iiif/3/img-8664_202009/manifest.json</div>
<div class="request">https://iiif.archive.org/iiif/img-8664_202009/manifest.json</div>

<h3>Note about IIIF Presentation API versions</h3>
<p>
Expand Down
14 changes: 7 additions & 7 deletions iiify/templates/docs/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3><a name="overview-conventions"></a>Convention: IDs</h3>
emphasis:
</p>

<div class="request">https://iiif.archive.org/iiif/3/<strong>:id</strong>/manifest.json</div>
<div class="request">https://iiif.archive.org/iiif/<strong>:id</strong>/manifest.json</div>
</section>

<h2>Getting started</h2>
Expand Down Expand Up @@ -45,7 +45,7 @@ <h2><a name="presentation-api"></a>Presentation API</h2>
<p>The Presentation API can also faciliate the portability and playback of time-based media like audio and video files. In the A/V context, IIIF manifests often present multiple playback options based on the media formats and quality types available.</p>

<p>A manifest for an Internet Archive item looks like this:</p>
<div class="request">https://iiif.archive.org/iiif/3/<b>:id</b>/manifest.json</div>
<div class="request">https://iiif.archive.org/iiif/<b>:id</b>/manifest.json</div>

<p>See the sections below for all the possible ways to retrieve manifests for <a href="#items">items</a> and <a href="#collections">collections</a>.</p>

Expand All @@ -66,10 +66,10 @@ <h2><a name="image-api"></a>Image API</h2>
<p>The Image API creates images using the following template: </p>
<div class="request">{scheme}://{server}/{prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}</div>
<p>In the context of the Internet Archive items, that will look like this for a full image:</p>
<div class="request">https://iiif.archive.org/image/iiif/3/<b>:id+filename</b>/full/max/0/default.jpg</div>
<div class="request">https://iiif.archive.org/image/iiif/<b>:id+filename</b>/full/max/0/default.jpg</div>

<p>Making use of the various parameters, a request for a bitonal center-cropped square image 375 pixels on each side, rotated 45 degrees will look like this:</p>
<div class="request">https://iiif.archive.org/image/iiif/3/<b>:id+filename</b>/square/375,/45/bitonal.jpg</div>
<div class="request">https://iiif.archive.org/image/iiif/<b>:id+filename</b>/square/375,/45/bitonal.jpg</div>

<p>See the <a href="https://iiif.io/api/image/3.0/#4-image-requests">Image API section on "Image Requests"</a> for more details on how images can be manipulated and specific sizes or sections retrieved.</p>

Expand All @@ -90,11 +90,11 @@ <h4>Example</h4>
<p>In order to get the :id+filename the way you need it for the IIIF Image API info.json, you can combine the ID and filename with a URL encoded slash, i.e. %2f.</p>

<p>So for this image, the info.json would be:</p>
<div class="request">https://iiif.archive.org/image/iiif/3/img-8664_202009%2fIMG_8664.jpg/info.json</div>
<div class="request">https://iiif.archive.org/image/iiif/img-8664_202009%2fIMG_8664.jpg/info.json</div>
<p>And the full URL for the image would be:</p>
<div class="request">https://iiif.archive.org/image/iiif/3/img-8664_202009%2fIMG_8664.jpg/full/max/0/default.jpg</div>
<div class="request">https://iiif.archive.org/image/iiif/img-8664_202009%2fIMG_8664.jpg/full/max/0/default.jpg</div>
<p>A cropped portion at the full resolution can be requested like this:</p>
<div class="request">https://iiif.archive.org/image/iiif/3/img-8664_202009%2fIMG_8664.jpg/<b>1100,904,704,664</b>/max/0/default.jpg</div>
<div class="request">https://iiif.archive.org/image/iiif/img-8664_202009%2fIMG_8664.jpg/<b>1100,904,704,664</b>/max/0/default.jpg</div>
<p>Where "1100,904,704,664" in that URL stands for 1100 pixels from the left edge, 904 pixels from the bottom edge, 704 pixels is the width of the desired section, and 664 pixels is the height.</p>


Expand Down
4 changes: 2 additions & 2 deletions iiify/templates/helper.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

<p>The manifest URL is: <a href="{{ uri }}/manifest.json">{{ uri }}/manifest.json</a></p>

<p>The Image API URL for the full image is: <a href="https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/full/max/0/default.jpg">https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/full/max/0/default.jpg</a></p>
<p>The Image API URL for the full image is: <a href="https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/full/max/0/default.jpg">https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/full/max/0/default.jpg</a></p>

<p>The Image API info.json for the image is: <a href="https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/info.json">https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/info.json</a></p>
<p>The Image API info.json for the image is: <a href="https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/info.json">https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/info.json</a></p>

</body>
</html>
12 changes: 6 additions & 6 deletions iiify/templates/helpers/audio.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ <h1>IIIF Presentation API Audio Helper</h1>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json</a></p>
<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json</a></p>

<h2>IIIF player options for this mediatype:</h2>
<ul>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Mirador comparison viewer/player</a></li>
<li><a href="https://iiif-react-media-player.netlify.app//?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Ramp</a></li>
<li><a href="https://iiif.aviaryplatform.com/player?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Aviary</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Clover</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Mirador comparison viewer/player</a></li>
<li><a href="https://iiif-react-media-player.netlify.app//?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Ramp</a></li>
<li><a href="https://iiif.aviaryplatform.com/player?manifest=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Aviary</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Clover</a></li>

</ul>

Expand Down
8 changes: 4 additions & 4 deletions iiify/templates/helpers/collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ <h1>IIIF Collection Helper</h1>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF collection URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json</a></p>
<p>The IIIF collection URL is: <a href="https://iiif.archive.org/iiif/{{ identifier }}/collection.json">https://iiif.archive.org/iiif/{{ identifier }}/collection.json</a></p>

<h2>IIIF viewer options</h2>
<ul>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/collection.json">Clover</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/collection.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/{{ identifier }}/collection.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/collection.json">Clover</a></li>

</ul>

Expand Down
16 changes: 8 additions & 8 deletions iiify/templates/helpers/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ <h1>IIIF Image Helper</h1>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json</a></p>
<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/{{ identifier }}/manifest.json</a></p>

<p>The Image API URL for the full image is: <a href="https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/full/max/0/default.jpg">https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/full/max/0/default.jpg</a></p>
<p>The Image API URL for the full image is: <a href="https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/full/max/0/default.jpg">https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/full/max/0/default.jpg</a></p>

<p>The Image API info.json for the image is: <a href="https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/info.json">https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}/info.json</a></p>
<p>The Image API info.json for the image is: <a href="https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/info.json">https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}/info.json</a></p>

<h2>IIIF viewer options</h2>
<ul>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Clover</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Clover</a></li>

</ul>

<h2>IIIF image tool options</h2>
<ul>
<li><a href="https://iiifimage.link/#https://iiif.archive.org/image/iiif/3/{{ esc_cantaloupe_id }}/full/max/0/default.jpg">IIIF Image Inspector</a></li>
<li><a href="https://iiifimage.link/#https://iiif.archive.org/image/iiif/{{ esc_cantaloupe_id }}/full/max/0/default.jpg">IIIF Image Inspector</a></li>
<li><a href="https://ncsu-libraries.github.io/iiif-crop-tool/?newUrl=https://iiif.archive.org/image/iiif/2/{{ esc_cantaloupe_id }}/full/full/0/default.jpg">NC State Image Cropper</a></li>
<li><a href="https://jbhoward-dublin.github.io/IIIF-imageManipulation/index.html?imageID=https://iiif.archive.org/image/iiif/3/{{ cantaloupe_id }}">IIIF Image Manipulation Tool</a></li>
<li><a href="https://jbhoward-dublin.github.io/IIIF-imageManipulation/index.html?imageID=https://iiif.archive.org/image/iiif/{{ cantaloupe_id }}">IIIF Image Manipulation Tool</a></li>
<li><a href="https://glenrobson.github.io/CanvasFinder/">CanvasFinder (Note: paste in the manifest URL noted above)</a></li>
</ul>

Expand Down
12 changes: 6 additions & 6 deletions iiify/templates/helpers/movies.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ <h1>IIIF Presentation API Movies Helper</h1>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json</a></p>
<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/{{ identifier }}/manifest.json</a></p>

<h2>IIIF viewer options for this mediatype:</h2>
<ul>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Mirador comparison viewer</a></li>
<li><a href="https://iiif-react-media-player.netlify.app//?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Ramp</a></li>
<li><a href="https://iiif.aviaryplatform.com/player?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Aviary</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Clover</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Mirador comparison viewer</a></li>
<li><a href="https://iiif-react-media-player.netlify.app//?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Ramp</a></li>
<li><a href="https://iiif.aviaryplatform.com/player?manifest=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Aviary</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Clover</a></li>

</ul>

Expand Down
8 changes: 4 additions & 4 deletions iiify/templates/helpers/texts.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ <h1>IIIF Presentation API Texts Helper</h1>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json</a></p>
<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/{{ identifier }}/manifest.json</a></p>

<h2>IIIF Viewer options for this mediatype:</h2>
<ul>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">Clover</a></li>
<li><a href="https://projectmirador.org/embed/?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Mirador</a></li>
<li><a href="https://uv-v4.netlify.app/#?manifest=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Universal Viewer</a></li>
<li><a href="https://samvera-labs.github.io/clover-iiif?iiif-content=https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">Clover</a></li>
</ul>

</body>
Expand Down
2 changes: 1 addition & 1 deletion iiify/templates/helpers/unknown.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>IIIF Presentation API Helper</h1>

<p>The IA identifier is: {{ identifier }}</p>

<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/3/{{ identifier }}/manifest.json</a></p>
<p>The IIIF manifest URL is: <a href="https://iiif.archive.org/iiif/{{ identifier }}/manifest.json">https://iiif.archive.org/iiif/{{ identifier }}/manifest.json</a></p>

<p>The material type of the item you're requested is not a recognized material type for IIIF viewers.</p>

Expand Down
Loading

0 comments on commit 5058046

Please sign in to comment.