Unverified Commit 6532ade9 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

remove /derived part from poster file name

parent 4f4f11dc
...@@ -27,19 +27,19 @@ object FileUtils { ...@@ -27,19 +27,19 @@ object FileUtils {
val rootPath = "/data" val rootPath = "/data"
def createVideoFile(id: String, mimeType: MimeType): String = val videoFilePath: (String, MimeType) => String =
s"$rootPath/$id.${getFileTypeExtension(mimeType).get}" (id, mimeType) => s"$rootPath/$id.${getFileTypeExtension(mimeType).get}"
def createVideoPosterFile(id: String): String = val videoPosterPath: String => String =
s"$rootPath/$id-poster.jp2" id => s"$rootPath/${id.replace("/derived", "")}-poster.jp2"
def createAudioFile(id: String): String = val audioFilePath: String => String =
s"$rootPath/$id.mp4" id => s"$rootPath/$id.mp4"
def createAudioSnippetFile(id: String): String = val audioSnippetPath: String => String =
s"$rootPath/$id-intro.mp3" id => s"$rootPath/$id-intro.mp3"
def createImageFile(id: String): String = val imageFilePath: String => String =
s"$rootPath/$id.jp2" id => s"$rootPath/$id.jp2"
} }
...@@ -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(createAudioFile(id), createAudioSnippetFile(id)) List(audioFilePath(id), audioSnippetPath(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 = createVideoFile(id, mT) val destFile = videoFilePath(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 = createImageFile(id) val destFile = imageFilePath(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 = createVideoPosterFile(id) val destFile = videoPosterPath(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((createAudioFile(id), false), (createAudioSnippetFile(id), true)) List((audioFilePath(id), false), (audioSnippetPath(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 = createVideoFile(id, mT) val destFile = videoFilePath(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 = createImageFile(id) val destFile = imageFilePath(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 = createVideoPosterFile(id) val destFile = videoPosterPath(id)
val res = fileHandler.createImageCopy(data, destFile, mT) val res = fileHandler.createImageCopy(data, destFile, mT)
createOutcome(res, id, destFile) createOutcome(res, id, destFile)
} }
......
Supports Markdown
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