mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
fix: Improve BatchesFolders; concatenate video files
This commit is contained in:
parent
89baa35ed7
commit
8c391a7504
@ -10,7 +10,7 @@ class AudioBatchesFolder(
|
|||||||
override val context: Context,
|
override val context: Context,
|
||||||
override val type: BatchType,
|
override val type: BatchType,
|
||||||
override val customFolder: DocumentFile? = null,
|
override val customFolder: DocumentFile? = null,
|
||||||
override val subfolderName: String = ".recordings",
|
override val subfolderName: String = ".audio_recordings",
|
||||||
) : BatchesFolder(
|
) : BatchesFolder(
|
||||||
context,
|
context,
|
||||||
type,
|
type,
|
||||||
@ -37,23 +37,24 @@ class AudioBatchesFolder(
|
|||||||
recordingStart: LocalDateTime,
|
recordingStart: LocalDateTime,
|
||||||
extension: String,
|
extension: String,
|
||||||
disableCache: Boolean,
|
disableCache: Boolean,
|
||||||
) {
|
): String {
|
||||||
if (!disableCache && checkIfOutputAlreadyExists(recordingStart, extension)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val filePaths = getBatchesForFFmpeg()
|
|
||||||
val outputFile = getOutputFileForFFmpeg(
|
val outputFile = getOutputFileForFFmpeg(
|
||||||
date = recordingStart,
|
date = recordingStart,
|
||||||
extension = extension,
|
extension = extension,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (disableCache || checkIfOutputAlreadyExists(recordingStart, extension)) {
|
||||||
|
val filePaths = getBatchesForFFmpeg()
|
||||||
|
|
||||||
MediaConverter.concatenateAudioFiles(
|
MediaConverter.concatenateAudioFiles(
|
||||||
inputFiles = filePaths,
|
inputFiles = filePaths,
|
||||||
outputFile = outputFile,
|
outputFile = outputFile,
|
||||||
).await()
|
).await()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return outputFile
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun viaInternalFolder(context: Context): BatchesFolder {
|
fun viaInternalFolder(context: Context): BatchesFolder {
|
||||||
return AudioBatchesFolder(context, BatchType.INTERNAL)
|
return AudioBatchesFolder(context, BatchType.INTERNAL)
|
||||||
|
@ -115,7 +115,7 @@ abstract class BatchesFolder(
|
|||||||
recordingStart: LocalDateTime,
|
recordingStart: LocalDateTime,
|
||||||
extension: String,
|
extension: String,
|
||||||
disableCache: Boolean = false,
|
disableCache: Boolean = false,
|
||||||
)
|
): String
|
||||||
|
|
||||||
fun exportFolderForSettings(): String {
|
fun exportFolderForSettings(): String {
|
||||||
return when (type) {
|
return when (type) {
|
||||||
|
@ -10,7 +10,7 @@ class VideoBatchesFolder(
|
|||||||
override val context: Context,
|
override val context: Context,
|
||||||
override val type: BatchesFolder.BatchType,
|
override val type: BatchesFolder.BatchType,
|
||||||
override val customFolder: DocumentFile? = null,
|
override val customFolder: DocumentFile? = null,
|
||||||
override val subfolderName: String = ".recordings",
|
override val subfolderName: String = ".video_recordings",
|
||||||
) : BatchesFolder(
|
) : BatchesFolder(
|
||||||
context,
|
context,
|
||||||
type,
|
type,
|
||||||
@ -34,23 +34,24 @@ class VideoBatchesFolder(
|
|||||||
recordingStart: LocalDateTime,
|
recordingStart: LocalDateTime,
|
||||||
extension: String,
|
extension: String,
|
||||||
disableCache: Boolean
|
disableCache: Boolean
|
||||||
) {
|
): String {
|
||||||
if (!disableCache && checkIfOutputAlreadyExists(recordingStart, extension)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val filePaths = getBatchesForFFmpeg()
|
|
||||||
val outputFile = getOutputFileForFFmpeg(
|
val outputFile = getOutputFileForFFmpeg(
|
||||||
date = recordingStart,
|
date = recordingStart,
|
||||||
extension = extension,
|
extension = extension,
|
||||||
)
|
)
|
||||||
|
|
||||||
MediaConverter.concatenateAudioFiles(
|
if (disableCache || !checkIfOutputAlreadyExists(recordingStart, extension)) {
|
||||||
|
val filePaths = getBatchesForFFmpeg()
|
||||||
|
|
||||||
|
MediaConverter.concatenateVideoFiles(
|
||||||
inputFiles = filePaths,
|
inputFiles = filePaths,
|
||||||
outputFile = outputFile,
|
outputFile = outputFile,
|
||||||
).await()
|
).await()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return outputFile
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun viaInternalFolder(context: Context): BatchesFolder {
|
fun viaInternalFolder(context: Context): BatchesFolder {
|
||||||
return VideoBatchesFolder(context, BatchType.INTERNAL)
|
return VideoBatchesFolder(context, BatchType.INTERNAL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user