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:
parent
d16fc2e446
commit
57ed102cda
5 changed files with 7 additions and 6 deletions
4
.github/ISSUE_TEMPLATE/bug-crash-report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug-crash-report.yml
vendored
|
@ -63,9 +63,9 @@ body:
|
||||||
description: |
|
description: |
|
||||||
If possible, provide a stack trace or a Logcat. This can help identify the issue.
|
If possible, provide a stack trace or a Logcat. This can help identify the issue.
|
||||||
To take a logcat, you must do the following:
|
To take a logcat, you must do the following:
|
||||||
1. Use a desktop/laptop to download the android platform tools from https://developer.android.com/studio/releases/platform-tools.
|
1. Use a desktop/laptop to download the android platform tools from [here](https://developer.android.com/studio/releases/platform-tools).
|
||||||
2. Extract the downloaded file to a folder.
|
2. Extract the downloaded file to a folder.
|
||||||
3. Enable USB debugging on your phone [See https://developer.android.com/studio/command-line/adb#Enabling], and then connect your
|
3. Enable USB debugging on your phone [Instructions](https://developer.android.com/studio/command-line/adb#Enabling), and then connect your
|
||||||
phone to a laptop. You will get a prompt to "Allow USB debugging" when you run the logcat command. Accept this.
|
phone to a laptop. You will get a prompt to "Allow USB debugging" when you run the logcat command. Accept this.
|
||||||
4. Open up a terminal/command prompt in that folder and run:
|
4. Open up a terminal/command prompt in that folder and run:
|
||||||
- `./adb -d logcat | grep -i "[DWE] Auxio"` in the case of a bug (may require some changes on windows)
|
- `./adb -d logcat | grep -i "[DWE] Auxio"` in the case of a bug (may require some changes on windows)
|
||||||
|
|
|
@ -54,7 +54,7 @@ object Images {
|
||||||
): FetchResult? {
|
): FetchResult? {
|
||||||
if (streams.size < 4) {
|
if (streams.size < 4) {
|
||||||
return streams.firstOrNull()?.let { stream ->
|
return streams.firstOrNull()?.let { stream ->
|
||||||
return SourceResult(
|
SourceResult(
|
||||||
source = ImageSource(stream.source().buffer(), context),
|
source = ImageSource(stream.source().buffer(), context),
|
||||||
mimeType = null,
|
mimeType = null,
|
||||||
dataSource = DataSource.DISK)
|
dataSource = DataSource.DISK)
|
||||||
|
|
|
@ -168,7 +168,7 @@ class ReadWriteCacheExtractor(private val context: Context) : WriteOnlyCacheExtr
|
||||||
* @see [CacheExtractor]
|
* @see [CacheExtractor]
|
||||||
*/
|
*/
|
||||||
private class CacheDatabase(context: Context) :
|
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) {
|
override fun onCreate(db: SQLiteDatabase) {
|
||||||
// Map the cacheable raw song fields to database fields. Cache-able in this context
|
// 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
|
// means information independent of the file-system, excluding IDs and timestamps required
|
||||||
|
|
|
@ -89,7 +89,7 @@ abstract class MediaStoreExtractor(
|
||||||
val args = mutableListOf<String>()
|
val args = mutableListOf<String>()
|
||||||
var selector = BASE_SELECTOR
|
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) {
|
if (settings.excludeNonMusic) {
|
||||||
logD("Excluding non-music")
|
logD("Excluding non-music")
|
||||||
selector += " AND ${MediaStore.Audio.AudioColumns.IS_MUSIC}=1"
|
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) {
|
override fun populateMetadata(cursor: Cursor, raw: Song.Raw) {
|
||||||
super.populateMetadata(cursor, 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
|
// Use the old column instead. See unpackTrackNo/unpackDiscNo for an explanation
|
||||||
// of how this column is set up.
|
// of how this column is set up.
|
||||||
val rawTrack = cursor.getIntOrNull(trackIndex)
|
val rawTrack = cursor.getIntOrNull(trackIndex)
|
||||||
|
|
|
@ -127,6 +127,7 @@ class PlaybackPanelFragment :
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.action_open_equalizer -> {
|
R.id.action_open_equalizer -> {
|
||||||
// Launch the system equalizer app, if possible.
|
// Launch the system equalizer app, if possible.
|
||||||
|
// TODO: Move this to a utility
|
||||||
val equalizerIntent =
|
val equalizerIntent =
|
||||||
Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL)
|
Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL)
|
||||||
// Provide audio session ID so equalizer can show options for this app
|
// Provide audio session ID so equalizer can show options for this app
|
||||||
|
|
Loading…
Reference in a new issue