music: move cache to storage
Move the music cache to the app storage. This is actually long-term data, so it makes more sense to do app storage where it's less likely to get mangled.
This commit is contained in:
@@ -54,7 +54,7 @@ object Images {
|
||||
): FetchResult? {
|
||||
if (streams.size < 4) {
|
||||
return streams.firstOrNull()?.let { stream ->
|
||||
return SourceResult(
|
||||
SourceResult(
|
||||
source = ImageSource(stream.source().buffer(), context),
|
||||
mimeType = null,
|
||||
dataSource = DataSource.DISK)
|
||||
|
||||
@@ -168,7 +168,7 @@ class ReadWriteCacheExtractor(private val context: Context) : WriteOnlyCacheExtr
|
||||
* @see [CacheExtractor]
|
||||
*/
|
||||
private class CacheDatabase(context: Context) :
|
||||
SQLiteOpenHelper(context, File(context.cacheDir, DB_NAME).absolutePath, null, DB_VERSION) {
|
||||
SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
|
||||
override fun onCreate(db: SQLiteDatabase) {
|
||||
// Map the cacheable raw song fields to database fields. Cache-able in this context
|
||||
// means information independent of the file-system, excluding IDs and timestamps required
|
||||
|
||||
@@ -89,7 +89,7 @@ abstract class MediaStoreExtractor(
|
||||
val args = mutableListOf<String>()
|
||||
var selector = BASE_SELECTOR
|
||||
|
||||
// Filter out music that is not music, if enabled.
|
||||
// Filter out audio that is not music, if enabled.
|
||||
if (settings.excludeNonMusic) {
|
||||
logD("Excluding non-music")
|
||||
selector += " AND ${MediaStore.Audio.AudioColumns.IS_MUSIC}=1"
|
||||
@@ -514,7 +514,7 @@ open class Api29MediaStoreExtractor(context: Context, cacheExtractor: CacheExtra
|
||||
|
||||
override fun populateMetadata(cursor: Cursor, raw: Song.Raw) {
|
||||
super.populateMetadata(cursor, raw)
|
||||
// This backend is volume-aware, but does not support the modern track columns.
|
||||
// This extractor is volume-aware, but does not support the modern track columns.
|
||||
// Use the old column instead. See unpackTrackNo/unpackDiscNo for an explanation
|
||||
// of how this column is set up.
|
||||
val rawTrack = cursor.getIntOrNull(trackIndex)
|
||||
|
||||
@@ -127,6 +127,7 @@ class PlaybackPanelFragment :
|
||||
when (item.itemId) {
|
||||
R.id.action_open_equalizer -> {
|
||||
// Launch the system equalizer app, if possible.
|
||||
// TODO: Move this to a utility
|
||||
val equalizerIntent =
|
||||
Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL)
|
||||
// Provide audio session ID so equalizer can show options for this app
|
||||
|
||||
Reference in New Issue
Block a user