mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
feat: Add support for custom folder
This commit is contained in:
parent
4126dded6e
commit
4af8cd7318
@ -32,13 +32,17 @@ class AudioBatchesFolder(
|
||||
): String {
|
||||
return when (type) {
|
||||
BatchType.INTERNAL -> asInternalGetOutputFile(date, extension).absolutePath
|
||||
BatchType.CUSTOM -> FFmpegKitConfig.getSafParameterForWrite(
|
||||
context,
|
||||
customFolder!!.createFile(
|
||||
"audio/${extension}",
|
||||
getName(date, extension),
|
||||
)!!.uri
|
||||
)!!
|
||||
BatchType.CUSTOM -> {
|
||||
val name = getName(date, extension)
|
||||
|
||||
FFmpegKitConfig.getSafParameterForWrite(
|
||||
context,
|
||||
(customFolder!!.findFile(name) ?: customFolder.createFile(
|
||||
"audio/${extension}",
|
||||
getName(date, extension),
|
||||
)!!).uri
|
||||
)!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
package app.myzel394.alibi.helpers
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import androidx.documentfile.provider.DocumentFile
|
||||
import com.arthenica.ffmpegkit.FFmpegKit
|
||||
import com.arthenica.ffmpegkit.FFmpegKitConfig
|
||||
import com.arthenica.ffmpegkit.ReturnCode
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import java.io.File
|
||||
@ -66,7 +69,8 @@ class MediaConverter {
|
||||
val listFile = createTempFile(inputFiles.joinToString("\n") { "file '$it'" })
|
||||
|
||||
val command =
|
||||
" -f concat" +
|
||||
"-protocol_whitelist saf,concat,content,file,subfile" +
|
||||
" -f concat" +
|
||||
" -safe 0" +
|
||||
" -i ${listFile.absolutePath}" +
|
||||
extraCommand +
|
||||
@ -78,7 +82,6 @@ class MediaConverter {
|
||||
command
|
||||
) { session ->
|
||||
runCatching {
|
||||
listFile.delete()
|
||||
}
|
||||
|
||||
if (!ReturnCode.isSuccess(session!!.returnCode)) {
|
||||
|
@ -28,13 +28,17 @@ class VideoBatchesFolder(
|
||||
override fun getOutputFileForFFmpeg(date: LocalDateTime, extension: String): String {
|
||||
return when (type) {
|
||||
BatchType.INTERNAL -> asInternalGetOutputFile(date, extension).absolutePath
|
||||
BatchType.CUSTOM -> FFmpegKitConfig.getSafParameterForWrite(
|
||||
context,
|
||||
customFolder!!.createFile(
|
||||
"video/${extension}",
|
||||
getName(date, extension),
|
||||
)!!.uri
|
||||
)!!
|
||||
BatchType.CUSTOM -> {
|
||||
val name = getName(date, extension)
|
||||
|
||||
FFmpegKitConfig.getSafParameterForWrite(
|
||||
context,
|
||||
(customFolder!!.findFile(name) ?: customFolder.createFile(
|
||||
"video/${extension}",
|
||||
getName(date, extension),
|
||||
)!!).uri
|
||||
)!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user