feat: Add now as filename format

Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
Myzel394 2024-06-09 18:00:27 +02:00
parent ac0fd3fed2
commit ffd1405a61
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
4 changed files with 19 additions and 1 deletions

View File

@ -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()
}
}

View File

@ -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,
)

View File

@ -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)
},
)
}
}
}

View File

@ -231,4 +231,6 @@
<string name="ui_settings_option_filenameFormat_action_relativeStart_label">Recording start</string>
<string name="ui_settings_option_filenameFormat_action_relativeStart_explanation">Use the time the actual recording starts at</string>
<string name="ui_settings_option_filenameFormat_success">The new format will be used for future recordings</string>
<string name="ui_settings_option_filenameFormat_action_now_label">Save time</string>
<string name="ui_settings_option_filenameFormat_action_now_explanation">Use the time you saved the recording</string>
</resources>