musikr: add date added support

Through a new `Tracker` interface.

Tracker is kind of a generic name. It's set up in the case that I have
to wind up associating more post-extraction metadata with songs.
This commit is contained in:
Alexander Capehart
2024-12-24 15:24:29 -05:00
parent c42ac644eb
commit ca6388b28d
12 changed files with 158 additions and 29 deletions
@@ -28,6 +28,7 @@ import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import org.oxycblt.musikr.cache.Cache
import org.oxycblt.musikr.playlist.db.StoredPlaylists
import org.oxycblt.musikr.track.Tracker
@Module
@InstallIn(SingletonComponent::class)
@@ -42,6 +43,8 @@ interface MusicModule {
class MusikrShimModule {
@Singleton @Provides fun cache(@ApplicationContext context: Context) = Cache.from(context)
@Singleton @Provides fun tracker(@ApplicationContext context: Context) = Tracker.from(context)
@Singleton
@Provides
fun storedPlaylists(@ApplicationContext context: Context) = StoredPlaylists.from(context)
@@ -42,6 +42,7 @@ import org.oxycblt.musikr.cache.WriteOnlyCache
import org.oxycblt.musikr.playlist.db.StoredPlaylists
import org.oxycblt.musikr.tag.interpret.Naming
import org.oxycblt.musikr.tag.interpret.Separators
import org.oxycblt.musikr.track.Tracker
import timber.log.Timber as L
/**
@@ -215,6 +216,7 @@ class MusicRepositoryImpl
constructor(
@ApplicationContext private val context: Context,
private val cache: Cache,
private val tracker: Tracker,
private val storedPlaylists: StoredPlaylists,
private val musicSettings: MusicSettings
) : MusicRepository {
@@ -365,7 +367,7 @@ constructor(
val newRevision = currentRevision?.takeIf { withCache } ?: UUID.randomUUID()
val cache = if (withCache) cache else WriteOnlyCache(cache)
val covers = MutableRevisionedStoredCovers(context, newRevision)
val storage = Storage(cache, covers, storedPlaylists)
val storage = Storage(cache, tracker, covers, storedPlaylists)
val interpretation = Interpretation(nameFactory, separators)
val newLibrary =