Minor update
This commit is contained in:
parent
528d07f645
commit
e6550bcfb0
@ -10,6 +10,10 @@ import java.io.File
|
||||
|
||||
|
||||
class MetadataMapping(val events: List<PersistentMessage>) {
|
||||
var collection: String?
|
||||
init {
|
||||
collection = getCollection()
|
||||
}
|
||||
|
||||
|
||||
fun map(): MetadataDto? {
|
||||
@ -25,7 +29,6 @@ class MetadataMapping(val events: List<PersistentMessage>) {
|
||||
}
|
||||
|
||||
val videoInfo = mediaReadOut?.toValueObject()
|
||||
val collection = mediaReadOut?.outDirectory?.let { File(it).name } ?: baseInfo?.title
|
||||
|
||||
|
||||
val mediaCover = if (coverDownloadTask != null || cover != null) {
|
||||
@ -51,12 +54,13 @@ class MetadataMapping(val events: List<PersistentMessage>) {
|
||||
} else null
|
||||
}
|
||||
|
||||
fun getCollection(): String? {
|
||||
private fun getCollection(): String? {
|
||||
val mediaReadOut = events.find { it.data is VideoInfoPerformed }?.data as VideoInfoPerformed?
|
||||
val baseInfo = events.find { it.data is BaseInfoPerformed }?.data as BaseInfoPerformed?
|
||||
if (!baseInfo.isSuccess()) {
|
||||
return null
|
||||
}
|
||||
return baseInfo?.title
|
||||
return mediaReadOut?.outDirectory?.let { File(it).name } ?: baseInfo?.title
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,7 +18,7 @@ class ProcessMapping(val events: List<PersistentMessage>) {
|
||||
referenceId = referenceId,
|
||||
process = processStarted?.type,
|
||||
inputFile = processStarted?.file,
|
||||
collection = meta.getCollection(),
|
||||
collection = meta.collection,
|
||||
metadata = meta.map(),
|
||||
videoDetails = VideoDetailsMapper(events).mapTo(),
|
||||
outputFiles = OutputFilesMapping(events).mapTo()
|
||||
|
||||
@ -53,7 +53,7 @@ class CollectAndStoreTask(@Autowired override var coordinator: Coordinator) : Ta
|
||||
return null
|
||||
}
|
||||
val mapped = ProcessMapping(events).map() ?: return null
|
||||
val collection = mapped.collection ?: return null
|
||||
val collection = mapped.metadata?.collection ?: mapped.collection ?: return null
|
||||
|
||||
val subtitlesStored = mapped.outputFiles?.subtitles?.let {
|
||||
storeSubtitles(collection = collection, subtitles = it)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user