Adjustment

This commit is contained in:
Brage 2023-07-24 01:26:07 +02:00
parent 4420c61a4f
commit 98179263f8
2 changed files with 8 additions and 6 deletions

View File

@ -37,11 +37,12 @@ class EncodeDaemon(val referenceId: String, val work: EncodeWork, val daemonInte
} }
suspend fun runUsingWorkItem(): Int { suspend fun runUsingWorkItem(): Int {
if (!File(work.outFile).parentFile.exists()) { val outFile = File(work.outFile)
File(work.outFile).parentFile.mkdirs() if (!outFile.parentFile.exists()) {
outFile.parentFile.mkdirs()
} }
val adjustedArgs = listOf( val adjustedArgs = listOf(
"-hide_banner", "-i", "'${work.inFile}'", *work.arguments.toTypedArray(), "'${work.outFile}'", "-hide_banner", "-i", File(work.inFile).absolutePath, *work.arguments.toTypedArray(), outFile.absolutePath,
"-progress", "pipe:1" "-progress", "pipe:1"
) + if (EncodeEnv.allowOverwrite) listOf("-y") else emptyList() ) + if (EncodeEnv.allowOverwrite) listOf("-y") else emptyList()
logger.info { "$referenceId @ ${work.workId} ${adjustedArgs.joinToString(" ")}" } logger.info { "$referenceId @ ${work.workId} ${adjustedArgs.joinToString(" ")}" }

View File

@ -15,11 +15,12 @@ class ExtractDaemon(val referenceId: String, val work: ExtractWork, val daemonIn
suspend fun runUsingWorkItem(): Int { suspend fun runUsingWorkItem(): Int {
if (!File(work.outFile).parentFile.exists()) { val outFile = File(work.outFile)
File(work.outFile).parentFile.mkdirs() if (!outFile.parentFile.exists()) {
outFile.parentFile.mkdirs()
} }
val adjustedArgs = listOf( val adjustedArgs = listOf(
"-hide_banner", "-i", "'${work.inFile}'", *work.arguments.toTypedArray(), "'${work.outFile}'", "-hide_banner", "-i", File(work.inFile).absolutePath, *work.arguments.toTypedArray(), outFile.absolutePath,
"-progress", "pipe:1" "-progress", "pipe:1"
) + if (EncodeEnv.allowOverwrite) listOf("-y") else emptyList() ) + if (EncodeEnv.allowOverwrite) listOf("-y") else emptyList()
logger.info { "$referenceId @ ${work.workId} ${adjustedArgs.joinToString(" ")}" } logger.info { "$referenceId @ ${work.workId} ${adjustedArgs.joinToString(" ")}" }