-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds a catalog endpoint for IIIF Presentation manifests To use, add '.iiif' to a catalog URL to get the IIIF presentation manifest. Also: * Updates Dockerfile to multi-stage build for 'development' and 'production'. * Move RedirectMiddleware to production environment only. * Use relative path for log location instaed of hard coded path. * Removes erroneously committed sprockets manifest. * Updates gitignore to include .vscode. Closes #2752. * Rearranges titles be arrays of internationalized titles rather than internationaled arrays of titles. Also adds IIIF JSON schems and json-schema gem to do validation soon.
- Loading branch information
Showing
14 changed files
with
1,334 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,3 +92,4 @@ gem 'bigdecimal', '1.4.4' | |
gem 'httparty' | ||
|
||
gem 'pbcore', '~> 0.2.0' | ||
gem 'json-schema', '~> 2.8.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
module IIIFManifest | ||
def iiif_manifest | ||
{ | ||
"@context" => "http://iiif.io/api/presentation/3/context.json", | ||
"id" => "#{aapb_host}/#{id}.iiif", | ||
"type" => "Manifest", | ||
"label" => i18n_titles, | ||
"metadata" => i18n_metadata, | ||
"homepage" => [{ | ||
"id" => "#{aapb_host}/catalog/#{id}", | ||
"type" => "Text", | ||
"label" => i18n_titles, | ||
"format" => "text/html" }], | ||
"summary" => i18n_descriptions, | ||
"items" => [ | ||
{ | ||
"id" => "#{aapb_host}/iiif/#{id}/canvas", | ||
"type" => "Canvas", | ||
"duration" => duration_seconds, | ||
# height and witdth would be required for video content | ||
"items" => [ | ||
{ | ||
"id" => "#{aapb_host}/iiif/#{id}/annotationpage/1", | ||
"type" => "AnnotationPage", | ||
"items" => [ | ||
{ | ||
"id" => "#{aapb_host}/iiif/#{id}/annotation/1", | ||
"type" => "Annotation", | ||
"motivation" => "painting", | ||
"body" => { | ||
"id" => location, # TODO: URI for media file, player will consume this and expect bits. Redirects ok. | ||
"type" => media_type, # TODO: map to "Sound" or "Video" | ||
"format" => media_format, | ||
"duration" => duration_seconds # TODO: just ensure it's in seconds | ||
}, | ||
"target" => "#{aapb_host}/iiif/canvas/1" # IMPORTANT: this has to be the ame as the 'id' property of the parent canvas | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}.to_json | ||
end | ||
|
||
def i18n_titles | ||
titles.map { |title| { "en" => [title] } } | ||
end | ||
|
||
def i18n_descriptions | ||
descriptions.map { |description| { "en" => [description] } } | ||
end | ||
|
||
def i18n_metadata | ||
metadata.map do |key, value| | ||
{ | ||
"label" => { | ||
"en" => [key] | ||
}, | ||
"value" => { | ||
"en" => [value] | ||
} | ||
} | ||
end | ||
end | ||
|
||
def metadata | ||
{ 'id' => id } | ||
end | ||
|
||
def duration_seconds | ||
duration.to_s.split(":").map(&:to_f).inject(0) { |a, e| a * 60 + e }.round(3) | ||
end | ||
|
||
def location | ||
URI.join(aapb_host, 'media', id).to_s | ||
end | ||
|
||
def aapb_host | ||
'https://americanarchive.org' | ||
end | ||
|
||
def media_format | ||
digital_instantiations.map(&:format).compact.first | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.