musikr: cleanup

This commit is contained in:
Alexander Capehart 2025-03-04 17:31:00 -07:00
parent 70b26dfb63
commit 9937e773a3
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -32,16 +32,12 @@ import org.oxycblt.musikr.metadata.Metadata
open class FolderCovers(private val context: Context) : Covers<FolderCover> { open class FolderCovers(private val context: Context) : Covers<FolderCover> {
override suspend fun obtain(id: String): CoverResult<FolderCover> { override suspend fun obtain(id: String): CoverResult<FolderCover> {
// Parse the ID to get the directory URI
if (!id.startsWith("folder:")) { if (!id.startsWith("folder:")) {
return CoverResult.Miss() return CoverResult.Miss()
} }
// TODO: Check if the dir actually exists still to avoid stale uris
val directoryUri = id.substring("folder:".length) val directoryUri = id.substring("folder:".length)
val uri = Uri.parse(directoryUri) val uri = Uri.parse(directoryUri)
// Check if the URI is still valid
val exists = val exists =
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
try { try {