Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
fb686f24
Unverified
Commit
fb686f24
authored
Oct 01, 2020
by
Sebastian Schüpbach
Browse files
remove data path settings
parent
fd1785c1
Pipeline
#15096
passed with stages
in 13 minutes and 19 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
k8s-manifests/test/deployment.yml
View file @
fb686f24
...
...
@@ -26,12 +26,6 @@ spec:
env
:
-
name
:
JOB_ID
value
:
media-converter
-
name
:
AUDIO_SINK_DIR
value
:
/data
-
name
:
IMAGE_SINK_DIR
value
:
/data
-
name
:
VIDEO_SINK_DIR
value
:
/data
-
name
:
AUDIO_SNIPPET_DURATION
value
:
"
30"
-
name
:
INTERNAL_BASE_URL
...
...
src/main/resources/app.yml
View file @
fb686f24
app
:
audioSinkDir
:
${AUDIO_SINK_DIR:?system}
imageSinkDir
:
${IMAGE_SINK_DIR:?system}
videoSinkDir
:
${VIDEO_SINK_DIR:?system}
audioSnippetDuration
:
${AUDIO_SNIPPET_DURATION:?system}
internalBaseUrl
:
${INTERNAL_BASE_URL:?system}
externalBaseUrl
:
${EXTERNAL_BASE_URL:?system}
...
...
src/main/scala/ch/memobase/App.scala
View file @
fb686f24
...
...
@@ -31,9 +31,6 @@ import scala.collection.JavaConverters._
object
App
extends
scala
.
App
with
Logging
{
val
settings
=
new
SettingsLoader
(
List
(
"audioSinkDir"
,
"imageSinkDir"
,
"videoSinkDir"
,
"audioSnippetDuration"
,
"internalBaseUrl"
,
"externalBaseUrl"
,
...
...
@@ -47,9 +44,6 @@ object App extends scala.App with Logging {
false
)
val
consumer
=
new
KafkaConsumer
[
String
,
String
](
settings
.
getKafkaConsumerSettings
)
val
fileHandler
=
new
DisseminationCopyHandler
(
settings
.
getAppSettings
.
getProperty
(
"audioSinkDir"
),
settings
.
getAppSettings
.
getProperty
(
"imageSinkDir"
),
settings
.
getAppSettings
.
getProperty
(
"videoSinkDir"
),
settings
.
getAppSettings
.
getProperty
(
"audioSnippetDuration"
).
toInt
)
val
fCWrapper
=
FedoraClientWrapper
(
settings
.
getAppSettings
.
getProperty
(
"internalBaseUrl"
),
...
...
src/main/scala/ch/memobase/DisseminationCopyHandler.scala
View file @
fb686f24
...
...
@@ -28,12 +28,8 @@ import scala.util.{Failure, Success, Try}
/**
* Manages dissemination copies of media files
*
* @param audioDestPath Path to folder containing audio dissemination copies
* @param imageDestPath Path to folder containing image dissemination copies
* @param videoDestPath Path to folder containing video dissemination copies
*/
class
DisseminationCopyHandler
(
audioDestPath
:
String
,
imageDestPath
:
String
,
videoDestPath
:
String
,
audioSnippetDuration
:
Int
)
{
class
DisseminationCopyHandler
(
audioSnippetDuration
:
Int
)
{
private
def
writeData
(
data
:
ByteArrayOutputStream
,
destFile
:
Path
)
:
Try
[
Path
]
=
{
Try
(
new
FileOutputStream
(
destFile
.
toFile
))
match
{
...
...
src/main/scala/ch/memobase/FileUtils.scala
View file @
fb686f24
...
...
@@ -25,7 +25,7 @@ object FileUtils {
import
models.Conversions._
val
rootPath
=
"/
medi
a"
val
rootPath
=
"/
dat
a"
def
createVideoFile
(
id
:
String
,
mimeType
:
MimeType
)
:
String
=
s
"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
...
...
src/test/scala/ch/memobase/DisseminationCopyHandlerTest.scala
View file @
fb686f24
...
...
@@ -20,12 +20,12 @@
package
ch.memobase
import
java.io.
{
ByteArrayOutputStream
,
File
,
FileInputStream
}
import
java.nio.file.
{
Files
,
Path
,
Paths
}
import
java.nio.file.
{
Files
,
Paths
}
import
ch.memobase.TestUtilities._
import
ch.memobase.models.
{
JpegFile
,
MimeType
,
Mp3File
,
VideoMpeg4File
}
import
org.scalatest.funsuite.AnyFunSuite
import
org.scalatest.
{
Assertion
,
BeforeAndAfter
}
import
TestUtilities._
import
scala.util.Try
...
...
@@ -34,7 +34,7 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter {
private
def
fixture
=
{
new
{
val
resPath
=
"src/test/resources"
val
fileHandler
=
new
DisseminationCopyHandler
(
resPath
,
resPath
,
resPath
,
30
)
val
fileHandler
=
new
DisseminationCopyHandler
(
30
)
}
}
...
...
@@ -67,12 +67,12 @@ class DisseminationCopyHandlerTest extends AnyFunSuite with BeforeAndAfter {
}
private
def
testAudioCopy
(
pathToTmpDir
:
String
,
sourceFileName
:
String
,
destFileName
:
String
,
fileType
:
MimeType
,
isSnippet
:
Boolean
,
copyFun
:
(
ByteArrayOutputStream
,
String
,
MimeType
,
Boolean
)
=>
Try
[
Boolean
])
:
Assertion
=
{
sourceFileName
:
String
,
destFileName
:
String
,
fileType
:
MimeType
,
isSnippet
:
Boolean
,
copyFun
:
(
ByteArrayOutputStream
,
String
,
MimeType
,
Boolean
)
=>
Try
[
Boolean
])
:
Assertion
=
{
val
file
=
Paths
.
get
(
pathToTmpDir
,
sourceFileName
).
toFile
val
data
=
new
ByteArrayOutputStream
(
file
.
length
().
toInt
)
val
buffer
=
new
Array
[
Byte
](
1024
)
...
...
src/test/scala/ch/memobase/RecordProcessorTest.scala
View file @
fb686f24
...
...
@@ -28,7 +28,6 @@ import org.scalamock.scalatest.MockFactory
import
org.scalatest.funsuite.AnyFunSuite
import
scala.io.Source
import
scala.util.Success
class
RecordProcessorTest
extends
AnyFunSuite
with
MockFactory
{
...
...
src/test/scala/ch/memobase/TestUtilities.scala
View file @
fb686f24
...
...
@@ -19,8 +19,6 @@
package
ch.memobase
import
org.scalatest.Assertion
import
scala.language.postfixOps
object
TestUtilities
{
...
...
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