music: rework indexer thread safety

Move the switch from IO to Main to within Indexer itself, through
withContext.

This is much easier to work with than the previous system of a separate
"update" coroutine, which isn't really needed anymore given that I no
longer need to do IO work when sanitizing the playback state.
This commit is contained in:
OxygenCobalt
2022-07-07 16:47:21 -06:00
parent 29cc680c34
commit 94f2d28936
22 changed files with 102 additions and 73 deletions
+5 -1
View File
@@ -205,8 +205,12 @@ This package also contains the two UI components used for all covers in Auxio:
This package contains all `Music` implementations, the music loading implementation, and the music folder system. This is the second
most complicated package in the app, as loading music in a sane way is horribly difficult.
Unlike other apps, Auxio does not load music from `MediaStore` as it is shown in the UI. That is dumb and stupid and prevents
any advanced features like Album Artists. Instead, we have a single loading process that constructs an entire in-memory music
library, which does increase memory usage, but allows for very high-quality metadata.
The major classes are:
- `MusicStore`, which is the container for a `Library` instance. Any code wanting to access the library should use this
- `MusicStore`, which is the container for a `Library` instance. Any code wanting to access the library should use this.
- `Indexer`, which manages how music is loaded. This is only used by code that must reflect the music loading state.
Internally, there are several other major systems: