Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
postprocessing
Media Converter
Commits
a04a7b94
Verified
Commit
a04a7b94
authored
Feb 16, 2022
by
Sebastian Schüpbach
Browse files
use correct path for poster image thumbnails
parent
dd623f13
Pipeline
#43112
passed with stages
in 6 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/scala/ch/memobase/FileUtils.scala
View file @
a04a7b94
...
...
@@ -44,12 +44,15 @@ trait FileUtils {
id
=>
s
"${normalize(rootPath)}/$id-intro.mp3"
val
imageFileRootPath
:
(
String
,
MimeType
)
=>
String
=
(
id
,
mimeType
)
=>
imageFilePath
(
rootPath
,
id
,
mimeType
)
(
id
,
mimeType
)
=>
imageFilePath
(
rootPath
,
id
,
mimeType
,
x
=>
x
)
val
cachedImage
FilePath
:
(
String
,
MimeType
)
=>
String
=
(
id
,
mimeType
)
=>
imageFilePath
(
cachedImagePath
,
id
,
mimeType
)
val
imageThumbnail
FilePath
:
(
String
,
MimeType
)
=>
String
=
(
id
,
mimeType
)
=>
imageFilePath
(
cachedImagePath
,
id
,
mimeType
,
x
=>
x
)
private
val
imageFilePath
:
(
String
,
String
,
MimeType
)
=>
String
=
(
path
,
id
,
mimeType
)
=>
s
"${normalize(path)}/$id.${getFileTypeExtension(mimeType).get}"
val
posterImageThumbnailFilePath
:
(
String
,
MimeType
)
=>
String
=
(
id
,
mimeType
)
=>
imageFilePath
(
cachedImagePath
,
id
,
mimeType
,
_
.
replace
(
"/derived"
,
"-poster"
))
private
val
imageFilePath
:
(
String
,
String
,
MimeType
,
String
=>
String
)
=>
String
=
(
path
,
id
,
mimeType
,
idTransform
)
=>
s
"${normalize(path)}/${idTransform(id)}.${getFileTypeExtension(mimeType).get}"
}
src/main/scala/ch/memobase/RecordProcessor.scala
View file @
a04a7b94
...
...
@@ -94,20 +94,21 @@ class RecordProcessor(fileHandler: DisseminationCopyHandler,
createOutcome
(
res
,
id
,
DigitalObject
,
destFile
)
case
mT
:
ImageFile
if
resource
=
=
DigitalObject
=>
val
destFile
=
imageFileRootPath
(
id
,
mT
)
createImageAndThumbnail
(
id
,
data
,
destFile
,
mT
,
DigitalObject
)
createImageAndThumbnail
(
id
,
data
,
destFile
,
mT
,
DigitalObject
,
imageThumbnailFilePath
)
case
mT
:
ImageFile
if
resource
=
=
VideoThumbnail
=>
val
destFile
=
videoPosterPath
(
id
,
mT
)
createImageAndThumbnail
(
id
,
data
,
destFile
,
mT
,
VideoThumbnail
)
createImageAndThumbnail
(
id
,
data
,
destFile
,
mT
,
VideoThumbnail
,
posterImageThumbnailFilePath
)
}
private
def
createImageAndThumbnail
(
id
:
String
,
data
:
ByteArrayOutputStream
,
destImageFile
:
String
,
mimeType
:
MimeType
,
memobaseResource
:
MemobaseResource
)
:
List
[
ProcessOutcome
]
=
{
memobaseResource
:
MemobaseResource
,
thumbnailFilePathFun
:
(
String
,
MimeType
)
=>
String
)
:
List
[
ProcessOutcome
]
=
{
val
resMediaFile
=
fileHandler
.
createImageCopy
(
data
,
destImageFile
,
mimeType
)
val
outcomeMediaFile
=
createOutcome
(
resMediaFile
,
id
,
memobaseResource
,
destImageFile
)
val
destPreviewFile
=
cachedImage
FilePath
(
id
,
mimeType
)
val
destPreviewFile
=
thumbnail
FilePath
Fun
(
id
,
mimeType
)
val
(
width
,
height
)
=
getThumbnailDimensions
val
resThumbnail
=
fileHandler
.
createImageThumbnail
(
destImageFile
,
destPreviewFile
,
width
,
height
)
val
outcomeThumbnail
=
createOutcome
(
resThumbnail
,
id
,
ImageThumbnail
,
destPreviewFile
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment