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