all: fix merge issues

This commit is contained in:
Alexander Capehart
2025-03-08 11:03:35 -07:00
parent e2d28f98f4
commit cd535eda2e
10 changed files with 29 additions and 36 deletions
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2025 Auxio Project
* InternalCovers.kt is part of Auxio.
* EmbeddedCovers.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,8 +23,6 @@ import android.net.Uri
import android.os.ParcelFileDescriptor
import java.io.InputStream
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.withContext
import org.oxycblt.musikr.covers.Cover
import org.oxycblt.musikr.covers.CoverResult
@@ -76,10 +74,7 @@ class MutableFSCovers(private val context: Context) : FSCovers(context), Mutable
private fun findCoverInDirectory(directory: DeviceDirectory): DeviceFile? {
return directory.children.firstNotNullOfOrNull { node ->
if (node is DeviceFile && isCoverArtFile(
node
)
) node else null
if (node is DeviceFile && isCoverArtFile(node)) node else null
}
}
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.musikr.fs.device
import android.content.ContentResolver
@@ -75,8 +75,7 @@ private class DeviceFSImpl(
location.uri,
DocumentsContract.getTreeDocumentId(location.uri),
location.path,
null
)
null)
}
private fun exploreDirectoryImpl(
@@ -116,8 +115,7 @@ private class DeviceFSImpl(
if (mimeType == DocumentsContract.Document.MIME_TYPE_DIR) {
recursive.add(
exploreDirectoryImpl(rootUri, childId, newPath, directoryDeferred)
)
exploreDirectoryImpl(rootUri, childId, newPath, directoryDeferred))
} else {
val size = cursor.getLong(sizeIndex)
val childUri = DocumentsContract.buildDocumentUriUsingTree(rootUri, childId)
@@ -128,8 +126,7 @@ private class DeviceFSImpl(
path = newPath,
size = size,
modifiedMs = lastModified,
parent = directoryDeferred
)
parent = directoryDeferred)
children.add(file)
emit(file)
}
@@ -146,7 +143,6 @@ private class DeviceFSImpl(
DocumentsContract.Document.COLUMN_DISPLAY_NAME,
DocumentsContract.Document.COLUMN_MIME_TYPE,
DocumentsContract.Document.COLUMN_SIZE,
DocumentsContract.Document.COLUMN_LAST_MODIFIED
)
DocumentsContract.Document.COLUMN_LAST_MODIFIED)
}
}
@@ -20,7 +20,6 @@ package org.oxycblt.musikr.pipeline
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.fold
import org.oxycblt.musikr.Interpretation
import org.oxycblt.musikr.MutableLibrary
import org.oxycblt.musikr.Storage
@@ -67,7 +67,9 @@ private class ExploreStepImpl(
val addingMs = System.currentTimeMillis()
return merge(
deviceFS
.explore(locations.asFlow(),)
.explore(
locations.asFlow(),
)
.filter { it.mimeType.startsWith("audio/") || it.mimeType == M3U.MIME_TYPE }
.distribute(8)
.distributedMap { file ->
@@ -72,4 +72,4 @@ internal suspend fun <T, A> Flow<T>.tryFold(initial: A, operation: suspend (A, T
}
}
return accumulator
}
}