Unverified Commit 85cf036e authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

try to fetch oembed object for every non-local media file

parent 75d8dc95
Pipeline #23987 passed with stages
in 3 minutes and 59 seconds
......@@ -147,7 +147,7 @@ class KafkaTopology(private val settings: SettingsLoader) {
Predicate { _, _ -> true } // Indicates a possible remote media file
)
val updateDigitalObjects = hasLocatorBranch[0]
val resourceWithLocalMediaFile = hasLocatorBranch[0]
.mapValues { readOnlyKey, value ->
val enrichedModel = addMediaSftpLocatorToModel(readOnlyKey, value)
if (enrichedModel.third.status == ReportStatus.warning) {
......@@ -166,7 +166,7 @@ class KafkaTopology(private val settings: SettingsLoader) {
)
}
val faroResource = hasLocatorBranch[2]
val resourceWithFaroMediaFile = hasLocatorBranch[2]
.mapValues { value ->
updateRecord(
value,
......@@ -175,7 +175,7 @@ class KafkaTopology(private val settings: SettingsLoader) {
)
}
val remoteThumbnails = hasLocatorBranch[3]
val resourceWithoutLocalMediaFile = hasLocatorBranch[3]
.mapValues { value ->
updateRecord(
value,
......@@ -183,29 +183,19 @@ class KafkaTopology(private val settings: SettingsLoader) {
digitalObjectMessage = "no local media files"
)
}
.branch(
Predicate { _, value -> value.third.status == "SUCCESS" }, // Local thumbnail linked; don't try to fetch others
Predicate { _, _ -> true } // Indicates a remote media file; check for youtube / vimeo thumbnail fetching
)
.mapValues { value -> fetchThumbnailForYoutubeOrVimeoFile(value) }
sendDownstream(resourceWithLocalMediaFile)
report(resourceWithLocalMediaFile)
sendDownstream(resourceWithoutAccessProp)
report(resourceWithoutAccessProp)
sendDownstream(faroResource)
report(faroResource)
sendDownstream(remoteThumbnails[0])
report(remoteThumbnails[0])
val remotelyEnrichedThumbnails =
remoteThumbnails[1]
.mapValues { value -> fetchThumbnailForYoutubeOrVimeoFile(value) }
sendDownstream(updateDigitalObjects)
report(updateDigitalObjects)
sendDownstream(resourceWithFaroMediaFile)
report(resourceWithFaroMediaFile)
sendDownstream(remotelyEnrichedThumbnails)
report(remotelyEnrichedThumbnails)
sendDownstream(resourceWithoutLocalMediaFile)
report(resourceWithoutLocalMediaFile)
return builder
}
......@@ -214,7 +204,6 @@ class KafkaTopology(private val settings: SettingsLoader) {
val downloadThumbnail = noThumbnailAttached(value.second)
val recordResource = getRecordResource(value.second)
val digitalObjectResource = getDigitalObjectResource(value.second)
log.info("recordResource $recordResource, digitalObjectResource $digitalObjectResource")
if (recordResource != null && digitalObjectResource != null) {
val locator = digitalObjectResource.getProperty(EBUCORE.locator).string
when {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment