Skip to content

Commit

Permalink
Merged in DSC-1619 (pull request DSpace#2224)
Browse files Browse the repository at this point in the history
DSC-1619

Approved-by: Giuseppe Digilio
  • Loading branch information
abollini authored and atarix83 committed May 29, 2024
2 parents 1cc78a8 + 06e6199 commit 747a74d
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.dspace.core.Context;
import org.dspace.event.Consumer;
import org.dspace.event.Event;
import org.dspace.services.ConfigurationService;
import org.dspace.utils.DSpace;


/**
Expand All @@ -37,12 +39,18 @@ public class IIIFCacheEventConsumer implements Consumer {
// Collects modified bitstreams for individual removal from canvas dimension cache.
private final Set<DSpaceObject> toEvictFromCanvasCache = new HashSet<>();

private ConfigurationService configurationService;

@Override
public void initialize() throws Exception {
configurationService = new DSpace().getConfigurationService();
}

@Override
public void consume(Context ctx, Event event) throws Exception {
if (!configurationService.getBooleanProperty("iiif.enabled", false)) {
return;
}
int st = event.getSubjectType();
if (!(st == Constants.BUNDLE || st == Constants.ITEM || st == Constants.BITSTREAM)) {
return;
Expand Down Expand Up @@ -136,6 +144,9 @@ private void addToCacheEviction(DSpaceObject subject, DSpaceObject subject2, int

@Override
public void end(Context ctx) throws Exception {
if (!configurationService.getBooleanProperty("iiif.enabled", false)) {
return;
}
// Get the eviction service beans.
ManifestsCacheEvictService manifestsCacheEvictService = CacheEvictBeanLocator.getManifestsCacheEvictService();
CanvasCacheEvictService canvasCacheEvictService = CacheEvictBeanLocator.getCanvasCacheEvictService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void findOneIIIFSearchableItemWithDefaultDimensionsIT() throws Exception
.andExpect(status().isOk())
.andExpect(jsonPath("$.@context", is("http://iiif.io/api/presentation/2/context.json")))
.andExpect(jsonPath("$.service.profile", is("http://iiif.io/api/search/0/search")))
.andExpect(jsonPath("$.thumbnail.@id", containsString("/iiif/2/"
.andExpect(jsonPath("$.thumbnail.@id", containsString("/iiif-server/"
+ bitstream1.getID())))
.andExpect(jsonPath("$.metadata[0].label", is("Title")))
.andExpect(jsonPath("$.metadata[0].value", is("Public item 1")))
Expand Down
6 changes: 5 additions & 1 deletion dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ filter.org.dspace.app.mediafilter.TikaTextExtractionFilter.inputFormats = OpenDo
filter.org.dspace.app.mediafilter.TikaTextExtractionFilter.inputFormats = OpenDocument Text
filter.org.dspace.app.mediafilter.TikaTextExtractionFilter.inputFormats = RTF
filter.org.dspace.app.mediafilter.TikaTextExtractionFilter.inputFormats = Text
filter.org.dspace.app.mediafilter.TikaTextExtractionFilter.inputFormats = TTML
filter.org.dspace.app.mediafilter.TikaTextExtractionFilter.inputFormats = WebVTT
filter.org.dspace.app.mediafilter.JPEGFilter.inputFormats = BMP, GIF, JPEG, PNG
filter.org.dspace.app.mediafilter.BrandedPreviewJPEGFilter.inputFormats = BMP, GIF, JPEG, PNG
filter.org.dspace.app.mediafilter.ImageMagickImageThumbnailFilter.inputFormats = BMP, GIF, PNG, JPG, TIFF, JPEG, JPEG 2000
Expand Down Expand Up @@ -802,7 +804,7 @@ event.dispatcher.default.class = org.dspace.event.BasicDispatcher
# Add rdf here, if you are using dspace-rdf to export your repository content as RDF.
# Add iiif here, if you are using dspace-iiif.
# Add orcidqueue here, if the integration with ORCID is configured and wish to enable the synchronization queue functionality
event.dispatcher.default.consumers = versioning, discovery, eperson, dedup, crisconsumer, orcidqueue, audit, nbeventsdelete, referenceresolver, orcidwebhook, itemenhancer, customurl, reciprocal, filetypemetadataenhancer, authoritylink
event.dispatcher.default.consumers = versioning, discovery, eperson, dedup, crisconsumer, orcidqueue, audit, nbeventsdelete, referenceresolver, orcidwebhook, itemenhancer, customurl, iiif, reciprocal, filetypemetadataenhancer, authoritylink

# enable the item enhancer poller
related-item-enhancer-poller.enabled = true
Expand Down Expand Up @@ -1018,6 +1020,7 @@ registry.metadata.load = workflow-types.xml
registry.metadata.load = openaire4-types.xml
registry.metadata.load = dspace-types.xml
registry.metadata.load = iiif-types.xml
registry.metadata.load = av-types.xml
registry.metadata.load = bitstream-types.xml
registry.metadata.load = dataquality-types.xml

Expand Down Expand Up @@ -1962,6 +1965,7 @@ include = ${module_dir}/authentication-shibboleth.cfg
include = ${module_dir}/authentication-x509.cfg
include = ${module_dir}/authentication-orcid.cfg
include = ${module_dir}/authority.cfg
include = ${module_dir}/av-stream.cfg
include = ${module_dir}/bulkedit.cfg
include = ${module_dir}/citation-page.cfg
include = ${module_dir}/clamav.cfg
Expand Down
4 changes: 4 additions & 0 deletions dspace/config/local-orchestrator.cfg.EXAMPLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# EXAMPLE "local-orchestrator-<env>.cfg" for the 4Science DSpace Orchestrator Addon.

solr-database-resync.cron = -
related-item-enhancer-poller.enabled = false
10 changes: 2 additions & 8 deletions dspace/config/local.cfg.EXAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,8 @@ usage-statistics.dbfile=/var/lib/GeoIP/GeoLite2-City.mmdb
# IIIF and OCR Integration #
############################

## IIIF configuration
iiif.enabled = false
# iiif.image.server =

## OCR configuration
# iiif.search.url = ${solr.server}/${solr.multicorePrefix}ocr
# iiif.search.plugin = org.dspace.app.iiif.service.WordHighlightSolrSearch
# ocr.tesseract.path =
## IIIF configuration (see modules/iiif.cfg)
#iiif.enabled = true

#########################################################
### LOGIN MIUR configuration ###
Expand Down
66 changes: 66 additions & 0 deletions dspace/config/modules/av-stream.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#---------------------------------------------------------------#
#-------------AV STREAMING CONFIGURATIONS-----------------------#
#---------------------------------------------------------------#
# Configuration properties used by the AV Streaming viewer #
# This configuration file is related to the 4Science AV addon #
# for more information see https://4science.com/dspace-add-ons/ #
#---------------------------------------------------------------#

video.valid-mimetype = video/webm, video/x-matroska, video/mpeg, video/quicktime,\
video/mp4, video/x-msvideo, video/x-flv, video/divx, video/3gpp, video/avi

audio.valid-mimetype = audio/x-mpeg, audio/x-pn-realaudio, audio/mpeg, audio/x-aiff,\
audio/basic, audio/x-wav, audio/mp4, audio/ogg, audio/flac,\
audio/aac, audio/ac3, audio/x-ms-wma, audio/vnd.wave, audio/mp3,\
video/ogg


# Only subtitles in VTT format are supported by the Video JS Player
subtitles.supported.mimetypes = text/vtt

audiowaveform.path = /usr/bin/audiowaveform
ffmpeg.path = /usr/bin/ffmpeg
ffprobe.path = /usr/bin/ffprobe
m4box.path = /usr/bin/MP4Box

stream-hq.height = 720
stream-hq.width = 1280
stream-mq.height = 480
stream-mq.width = 640
stream-lq.height = 180
stream-lq.width = 320
stream-original.enabled = true

# use the follow configuration when the curation task have to work only on a certain bundle name
#input-audio-bundle-name = ORIGINAL
#input-video-bundle-name = ORIGINAL

# use the following to edit the max width for a thumbnail (Default is 500px)
# Height is set to keep the aspect ratio so it cannot be edited

filter-media.video.thumbnail.max-width = 500
filter-media.audio.thumbnail.max-width = 200
filter-media.audio.thumbnail.max-height = 100

# The following configuration allows to skip the retrieval
# of several scenes in a specified time period (seconds)
#scene.discading.interval = 30

scene.thumbnail.max-width = 500
video.thumbnail.max-number = 20

### Configure the transcribe service ###

# Choose the correct service plugin
av-stream.transcribe-service.plugin = whisper-service
#av-stream.transcribe-service.plugin = aws-transcribe-service


### WHISPER Transcribe Configuration ###

whisper.fullpath = ~/.local/bin/whisper

### Whisper models are: tiny - base - small - medium - large
whisper.default.transcription-model = base

whisper.transcription-format = vtt
5 changes: 3 additions & 2 deletions dspace/config/modules/deduplication.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ deduplication.facet-limit = 150
#------------DEDUPLICATION / DATAQUALITY CONFIGURATIONS------------#
#------------------------------------------------------------------#
# #
# Configurations for the Deduplication / DataQuality features #
# #
# The configurations below are related to the extra #
# functionalities provided by the 4Science Data Quality addon #
# for more information see https://4science.com/dspace-add-ons/ #
#------------------------------------------------------------------#
# metadata here listed will be excluded by merge tool logic
merge.excluded-metadata = dc.description.provenance, datacite.rights, dc.date.accessioned, dc.date.modified, dc.date.available, dspace.entity.type
11 changes: 10 additions & 1 deletion dspace/config/modules/iiif.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ iiif.enabled = false

# Public base url of a iiif server able to serve DSpace images. The bitstream
# uuid is appended to this URL
iiif.image.server = http://localhost:8182/iiif/2/
iiif.image.server = ${dspace.ui.url}/iiif-server/

# Base URL of the search service used to support the (experimental) IIIF Search
# capability. The actual path will depend on how search is being supported.
Expand Down Expand Up @@ -110,6 +110,15 @@ iiif.search.rows = 120
# If you choose to encode utf8 for solr indexing, set this property to true.
iiif.search.index.xml.encode = false

#------------------------------------------------------------------#
#------------ IIIF Plus CONFIGURATIONS ------------#
#------------------------------------------------------------------#
# #
# The configurations below are related to the extra #
# functionalities provided by the 4Science IIIF Plus addon #
# for more information see https://4science.com/dspace-add-ons/ #
#------------------------------------------------------------------#

# Valid formats
iiif.valid-formats = JPEG
iiif.valid-formats = GIF
Expand Down
4 changes: 3 additions & 1 deletion dspace/config/modules/networklab.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#---------------------------------------------------------------------#
#-------------------Networklab Addon CONFIGURATIONS-------------------#
#---------------------------------------------------------------------#
# Configuration properties used by the addon module #
# This configuration file is related to the 4Science #
# Network Labs addon #
# for more information see https://4science.com/dspace-add-ons/ #
#---------------------------------------------------------------------#

# Url of the neo4j instance
Expand Down
2 changes: 2 additions & 0 deletions dspace/config/modules/ocr.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#### OCR CONFIGURATION ####
# This configuration file is related to the 4Science OCR addon
# for more information see https://4science.com/dspace-add-ons/

# IIIF Search settings are defined in iiif module file, so see the iiif.cfg file

Expand Down
151 changes: 151 additions & 0 deletions dspace/config/registries/av-types.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<dspace-dc-types>

<dspace-header>
<title>DSpace Audio/Video Addon Schema</title>
<contributor.author>Stefano Maffei</contributor.author>
</dspace-header>

<dc-schema>
<name>bitstream</name>
<namespace>https://4science.it/audiovideo</namespace>
</dc-schema>

<dc-schema>
<name>dash</name>
<namespace>https://4science.it/dash</namespace>
</dc-schema>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>dashbundle</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>dash</schema>
<element>manifest</element>
<qualifier></qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>height</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>width</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>duration</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>format</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>codec</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>fps</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>audioformat</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>video</element>
<qualifier>audiocodec</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>audio</element>
<qualifier>peaks</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>scene</element>
<qualifier>timestamp</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>category</element>
<qualifier></qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>transcribe</element>
<qualifier>request</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>transcribe</element>
<qualifier>processed</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>whisper</element>
<qualifier>model</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>transcribe</element>
<qualifier>request</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>transcribe</element>
<qualifier>processed</qualifier>
<scope_note></scope_note>
</dc-type>

<dc-type>
<schema>bitstream</schema>
<element>whisper</element>
<qualifier>model</qualifier>
<scope_note></scope_note>
</dc-type>

</dspace-dc-types>
Loading

0 comments on commit 747a74d

Please sign in to comment.