Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: non audio files appearing in recordings (fix #237)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Dec 18, 2023
1 parent d9f8d22 commit 89d17ab
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions app/src/main/java/com/bnyro/recorder/util/FileRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,32 @@ interface FileRepository {
}

class FileRepositoryImpl(val context: Context) : FileRepository {
private val commonAudioExtensions = listOf(
".mp3",
".aac",
".ogg",
".wma",
".3gp",
".wav"
)

private val commonVideoExtensions = listOf(
".mp4",
".mov",
".avi",
".mkv",
".webm",
".mpg"
)

private fun getVideoFiles(): List<DocumentFile> =
getOutputDir().listFiles().filter {
it.isFile && it.name.orEmpty().endsWith("mp4")
getOutputDir().listFiles().filter { file ->
file.isFile && commonVideoExtensions.any { file.name?.endsWith(it) ?: false }
}

private fun getAudioFiles(): List<DocumentFile> =
getOutputDir().listFiles().filter {
it.isFile && !it.name.orEmpty().endsWith("mp4")
getOutputDir().listFiles().filter { file ->
file.isFile && commonAudioExtensions.any { file.name?.endsWith(it) ?: false }
}

override suspend fun getVideoRecordingItems(sortOrder: SortOrder): List<RecordingItemData> {
Expand Down

0 comments on commit 89d17ab

Please sign in to comment.