music: move cover parsing to indexing

This drastically slows music loading, but my hope is that in practice
most of the slowdown is actually in ExoPlayer's metadata extractor and
if I switch off of that things will actually improve. Maybe.
This commit is contained in:
Alexander Capehart
2024-12-11 16:55:37 -07:00
parent b53b7a0c6a
commit 42390f4b3f
8 changed files with 49 additions and 32 deletions
@@ -18,6 +18,8 @@
package org.oxycblt.auxio.music
import android.content.Context
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
@@ -209,6 +211,7 @@ class MusicRepositoryImpl
@Inject
constructor(
private val musikr: Musikr,
@ApplicationContext private val context: Context,
private val tagDatabase: TagDatabase,
private val musicSettings: MusicSettings
) : MusicRepository {
@@ -358,9 +361,10 @@ constructor(
val storage =
if (withCache) {
Storage(TagCache.full(tagDatabase), StoredCovers.buildOn())
Storage(TagCache.full(tagDatabase), StoredCovers.from(context, "covers"))
} else {
Storage(TagCache.writeOnly(tagDatabase), StoredCovers.new())
// TODO: Revisioned covers
Storage(TagCache.writeOnly(tagDatabase), StoredCovers.from(context, "covers"))
}
val newLibrary =
musikr.run(