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
6532ade9
Unverified
Commit
6532ade9
authored
Dec 07, 2020
by
Sebastian Schüpbach
Browse files
remove /derived part from poster file name
parent
4f4f11dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/scala/ch/memobase/FileUtils.scala
View file @
6532ade9
...
@@ -27,19 +27,19 @@ object FileUtils {
...
@@ -27,19 +27,19 @@ object FileUtils {
val
rootPath
=
"/data"
val
rootPath
=
"/data"
def
createV
ideoFile
(
id
:
String
,
mimeType
:
MimeType
)
:
String
=
val
v
ideoFile
Path
:
(
String
,
MimeType
)
=>
String
=
s
"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
(
id
,
mimeType
)
=>
s
"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
def
createV
ideoPoster
File
(
id
:
String
)
:
String
=
val
v
ideoPoster
Path
:
String
=>
String
=
s
"$rootPath/$id-poster.jp2"
id
=>
s
"$rootPath/$
{
id
.replace("
/
derived
", "")}
-poster.jp2"
def
createA
udioFile
(
id
:
String
)
:
String
=
val
a
udioFile
Path
:
String
=>
String
=
s
"$rootPath/$id.mp4"
id
=>
s
"$rootPath/$id.mp4"
def
createA
udioSnippet
File
(
id
:
String
)
:
String
=
val
a
udioSnippet
Path
:
String
=>
String
=
s
"$rootPath/$id-intro.mp3"
id
=>
s
"$rootPath/$id-intro.mp3"
def
createI
mageFile
(
id
:
String
)
:
String
=
val
i
mageFile
Path
:
String
=>
String
=
s
"$rootPath/$id.jp2"
id
=>
s
"$rootPath/$id.jp2"
}
}
src/main/scala/ch/memobase/RecordProcessor.scala
View file @
6532ade9
...
@@ -89,19 +89,19 @@ class RecordProcessor(fileHandler: DisseminationCopyHandler,
...
@@ -89,19 +89,19 @@ class RecordProcessor(fileHandler: DisseminationCopyHandler,
mimeType
:
MimeType
,
mimeType
:
MimeType
,
instantiationType
:
Instantiation
)
:
List
[
ProcessOutcome
]
=
mimeType
match
{
instantiationType
:
Instantiation
)
:
List
[
ProcessOutcome
]
=
mimeType
match
{
case
_:
AudioFile
=>
case
_:
AudioFile
=>
List
(
createA
udioFile
(
id
),
createA
udioSnippet
File
(
id
))
List
(
a
udioFile
Path
(
id
),
a
udioSnippet
Path
(
id
))
.
map
(
path
=>
(
fileHandler
.
deleteAudioCopy
(
path
),
path
))
.
map
(
path
=>
(
fileHandler
.
deleteAudioCopy
(
path
),
path
))
.
flatMap
(
x
=>
deleteOutcome
(
x
.
_1
,
id
,
x
.
_2
))
.
flatMap
(
x
=>
deleteOutcome
(
x
.
_1
,
id
,
x
.
_2
))
case
mT
:
VideoFile
=>
case
mT
:
VideoFile
=>
val
destFile
=
createV
ideoFile
(
id
,
mT
)
val
destFile
=
v
ideoFile
Path
(
id
,
mT
)
val
res
=
fileHandler
.
deleteVideoCopy
(
destFile
)
val
res
=
fileHandler
.
deleteVideoCopy
(
destFile
)
deleteOutcome
(
res
,
id
,
destFile
)
deleteOutcome
(
res
,
id
,
destFile
)
case
_:
ImageFile
if
instantiationType
=
=
DigitalObject
=>
case
_:
ImageFile
if
instantiationType
=
=
DigitalObject
=>
val
destFile
=
createI
mageFile
(
id
)
val
destFile
=
i
mageFile
Path
(
id
)
val
res
=
fileHandler
.
deleteImageCopy
(
destFile
)
val
res
=
fileHandler
.
deleteImageCopy
(
destFile
)
deleteOutcome
(
res
,
id
,
destFile
)
deleteOutcome
(
res
,
id
,
destFile
)
case
_:
ImageFile
if
instantiationType
=
=
Thumbnail
=>
case
_:
ImageFile
if
instantiationType
=
=
Thumbnail
=>
val
destFile
=
createV
ideoPoster
File
(
id
)
val
destFile
=
v
ideoPoster
Path
(
id
)
val
res
=
fileHandler
.
deleteImageCopy
(
destFile
)
val
res
=
fileHandler
.
deleteImageCopy
(
destFile
)
deleteOutcome
(
res
,
id
,
destFile
)
deleteOutcome
(
res
,
id
,
destFile
)
}
}
...
@@ -111,19 +111,19 @@ class RecordProcessor(fileHandler: DisseminationCopyHandler,
...
@@ -111,19 +111,19 @@ class RecordProcessor(fileHandler: DisseminationCopyHandler,
instantiationType
:
Instantiation
,
instantiationType
:
Instantiation
,
data
:
ByteArrayOutputStream
)
:
List
[
ProcessOutcome
]
=
mimeType
match
{
data
:
ByteArrayOutputStream
)
:
List
[
ProcessOutcome
]
=
mimeType
match
{
case
mT
:
AudioFile
=>
case
mT
:
AudioFile
=>
List
((
createA
udioFile
(
id
),
false
),
(
createA
udioSnippet
File
(
id
),
true
))
List
((
a
udioFile
Path
(
id
),
false
),
(
a
udioSnippet
Path
(
id
),
true
))
.
map
(
path
=>
(
fileHandler
.
createAudioCopy
(
data
,
path
.
_1
,
mT
,
path
.
_2
),
path
.
_1
))
.
map
(
path
=>
(
fileHandler
.
createAudioCopy
(
data
,
path
.
_1
,
mT
,
path
.
_2
),
path
.
_1
))
.
flatMap
(
x
=>
createOutcome
(
x
.
_1
,
id
,
x
.
_2
))
.
flatMap
(
x
=>
createOutcome
(
x
.
_1
,
id
,
x
.
_2
))
case
mT
:
VideoFile
=>
case
mT
:
VideoFile
=>
val
destFile
=
createV
ideoFile
(
id
,
mT
)
val
destFile
=
v
ideoFile
Path
(
id
,
mT
)
val
res
=
fileHandler
.
createVideoCopy
(
data
,
destFile
,
mT
)
val
res
=
fileHandler
.
createVideoCopy
(
data
,
destFile
,
mT
)
createOutcome
(
res
,
id
,
destFile
)
createOutcome
(
res
,
id
,
destFile
)
case
mT
:
ImageFile
if
instantiationType
=
=
DigitalObject
=>
case
mT
:
ImageFile
if
instantiationType
=
=
DigitalObject
=>
val
destFile
=
createI
mageFile
(
id
)
val
destFile
=
i
mageFile
Path
(
id
)
val
res
=
fileHandler
.
createImageCopy
(
data
,
destFile
,
mT
)
val
res
=
fileHandler
.
createImageCopy
(
data
,
destFile
,
mT
)
createOutcome
(
res
,
id
,
destFile
)
createOutcome
(
res
,
id
,
destFile
)
case
mT
:
ImageFile
if
instantiationType
=
=
Thumbnail
=>
case
mT
:
ImageFile
if
instantiationType
=
=
Thumbnail
=>
val
destFile
=
createV
ideoPoster
File
(
id
)
val
destFile
=
v
ideoPoster
Path
(
id
)
val
res
=
fileHandler
.
createImageCopy
(
data
,
destFile
,
mT
)
val
res
=
fileHandler
.
createImageCopy
(
data
,
destFile
,
mT
)
createOutcome
(
res
,
id
,
destFile
)
createOutcome
(
res
,
id
,
destFile
)
}
}
...
...
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