From ffd1405a61da88a69e3a1f23f85ae8eb6f12372c Mon Sep 17 00:00:00 2001
From: Myzel394 <50424412+Myzel394@users.noreply.github.com>
Date: Sun, 9 Jun 2024 18:00:27 +0200
Subject: [PATCH] feat: Add now as filename format
Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
---
.../main/java/app/myzel394/alibi/db/AppSettings.kt | 3 +++
.../java/app/myzel394/alibi/helpers/BatchesFolder.kt | 3 ++-
.../SettingsScreen/Tiles/FilenameFormatTile.kt | 12 ++++++++++++
app/src/main/res/values/strings.xml | 2 ++
4 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt b/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt
index aa37cdc..2d49749 100644
--- a/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt
+++ b/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt
@@ -143,6 +143,7 @@ data class AppSettings(
enum class FilenameFormat {
DATETIME_ABSOLUTE_START,
DATETIME_RELATIVE_START,
+ DATETIME_NOW,
}
companion object {
@@ -183,6 +184,8 @@ data class RecordingInformation(
AppSettings.FilenameFormat.DATETIME_RELATIVE_START -> LocalDateTime.now().minusSeconds(
getFullDuration() / 1000
)
+
+ AppSettings.FilenameFormat.DATETIME_NOW -> LocalDateTime.now()
}
}
diff --git a/app/src/main/java/app/myzel394/alibi/helpers/BatchesFolder.kt b/app/src/main/java/app/myzel394/alibi/helpers/BatchesFolder.kt
index 42887aa..5bcad5c 100644
--- a/app/src/main/java/app/myzel394/alibi/helpers/BatchesFolder.kt
+++ b/app/src/main/java/app/myzel394/alibi/helpers/BatchesFolder.kt
@@ -257,6 +257,7 @@ abstract class BatchesFolder(
onProgress: (Float?) -> Unit = {},
): String {
val disableCache = disableCache ?: (type != BatchType.INTERNAL)
+ val date = recording.getStartDateForFilename(filenameFormat)
if (!disableCache && checkIfOutputAlreadyExists(
recording.recordingStart,
@@ -279,7 +280,7 @@ abstract class BatchesFolder(
val filePaths = getBatchesForFFmpeg()
val outputFile = getOutputFileForFFmpeg(
- date = recording.getStartDateForFilename(filenameFormat),
+ date = date,
extension = recording.fileExtension,
)
diff --git a/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/FilenameFormatTile.kt b/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/FilenameFormatTile.kt
index bbb98e0..c8a17b2 100644
--- a/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/FilenameFormatTile.kt
+++ b/app/src/main/java/app/myzel394/alibi/ui/components/SettingsScreen/Tiles/FilenameFormatTile.kt
@@ -14,6 +14,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.TextSnippet
import androidx.compose.material.icons.filled.AccessTime
+import androidx.compose.material.icons.filled.Circle
import androidx.compose.material.icons.filled.Timelapse
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
@@ -178,6 +179,17 @@ private fun SelectionSheet(
updateValue(AppSettings.FilenameFormat.DATETIME_RELATIVE_START)
},
)
+
+ HorizontalDivider()
+
+ SelectionButton(
+ label = stringResource(R.string.ui_settings_option_filenameFormat_action_now_label),
+ explanation = stringResource(R.string.ui_settings_option_filenameFormat_action_now_explanation),
+ icon = Icons.Default.Circle,
+ onClick = {
+ updateValue(AppSettings.FilenameFormat.DATETIME_RELATIVE_START)
+ },
+ )
}
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 514593a..25dbb43 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -231,4 +231,6 @@
Recording start
Use the time the actual recording starts at
The new format will be used for future recordings
+ Save time
+ Use the time you saved the recording
\ No newline at end of file