Fixed some issues
This commit is contained in:
parent
8723b73c6e
commit
dc8d5c44e4
@ -3,7 +3,7 @@ package no.iktdev.streamit.content.common.dto.reader
|
||||
import java.io.File
|
||||
|
||||
data class SubtitleInfo(
|
||||
val inputFile: File,
|
||||
val inputFile: String,
|
||||
val collection: String,
|
||||
val language: String
|
||||
)
|
||||
@ -6,6 +6,7 @@ import no.iktdev.library.subtitle.Syncro
|
||||
import no.iktdev.library.subtitle.export.Export
|
||||
import no.iktdev.library.subtitle.reader.BaseReader
|
||||
import no.iktdev.library.subtitle.reader.Reader
|
||||
import no.iktdev.streamit.content.common.dto.reader.SubtitleInfo
|
||||
import no.iktdev.streamit.content.common.dto.reader.work.ConvertWork
|
||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
||||
import java.io.File
|
||||
@ -17,7 +18,8 @@ class ConvertRunner(val referenceId: String, val listener: IConvertListener) {
|
||||
}
|
||||
|
||||
suspend fun readAndConvert (subtitleInfo: SubtitleInfo) {
|
||||
val reader = getReade(subtitleInfo.inputFile)
|
||||
val inFile = File(subtitleInfo.inputFile)
|
||||
val reader = getReade(inFile)
|
||||
val dialogs = reader?.read()
|
||||
if (dialogs.isNullOrEmpty()) {
|
||||
withContext(Dispatchers.Default) {
|
||||
@ -32,10 +34,10 @@ class ConvertRunner(val referenceId: String, val listener: IConvertListener) {
|
||||
|
||||
val syncedDialogs = Syncro().sync(dialogs)
|
||||
|
||||
val converted = Export(subtitleInfo.inputFile, syncedDialogs).write()
|
||||
val converted = Export(inFile, syncedDialogs).write()
|
||||
converted.forEach {
|
||||
val item = ConvertWork(
|
||||
inFile = subtitleInfo.inputFile.absolutePath,
|
||||
inFile = inFile.absolutePath,
|
||||
collection = subtitleInfo.collection,
|
||||
language = subtitleInfo.language,
|
||||
outFile = it.absolutePath
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
package no.iktdev.streamit.content.convert
|
||||
|
||||
import java.io.File
|
||||
|
||||
data class SubtitleInfo(
|
||||
val inputFile: File,
|
||||
val collection: String,
|
||||
val language: String
|
||||
)
|
||||
@ -5,11 +5,11 @@ import mu.KotlinLogging
|
||||
import no.iktdev.exfl.coroutines.Coroutines
|
||||
import no.iktdev.streamit.content.common.CommonConfig
|
||||
import no.iktdev.streamit.content.common.DefaultKafkaReader
|
||||
import no.iktdev.streamit.content.common.dto.reader.SubtitleInfo
|
||||
import no.iktdev.streamit.content.common.dto.reader.work.ConvertWork
|
||||
import no.iktdev.streamit.content.common.dto.reader.work.ExtractWork
|
||||
import no.iktdev.streamit.content.convert.ConvertRunner
|
||||
import no.iktdev.streamit.content.convert.IConvertListener
|
||||
import no.iktdev.streamit.content.convert.SubtitleInfo
|
||||
import no.iktdev.streamit.library.kafka.KafkaEvents
|
||||
import no.iktdev.streamit.library.kafka.dto.Message
|
||||
import no.iktdev.streamit.library.kafka.dto.Status
|
||||
@ -36,7 +36,7 @@ class SubtitleConsumer: DefaultKafkaReader("convertHandlerSubtitle"), IConvertLi
|
||||
if (workResult?.produceConvertEvent == true) {
|
||||
logger.info { "Using ${data.value().referenceId} ${workResult.outFile} as it is a convert candidate" }
|
||||
val convertWork = SubtitleInfo(
|
||||
inputFile = File(workResult.outFile),
|
||||
inputFile = workResult.outFile,
|
||||
collection = workResult.collection,
|
||||
language = workResult.language,
|
||||
)
|
||||
|
||||
@ -64,7 +64,6 @@ class EncodeDaemon(val referenceId: String, val work: EncodeWork, val daemonInte
|
||||
}
|
||||
override fun onOutputChanged(line: String) {
|
||||
super.onOutputChanged(line)
|
||||
logger.info { line }
|
||||
outputCache.add(line)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user