music: add setting to ignore hidden files during music loading
This commit is contained in:
parent
e2b0601d4c
commit
10eb0be7d0
4 changed files with 26 additions and 3 deletions
|
@ -384,13 +384,14 @@ constructor(
|
||||||
Naming.simple()
|
Naming.simple()
|
||||||
}
|
}
|
||||||
val locations = musicSettings.musicLocations
|
val locations = musicSettings.musicLocations
|
||||||
|
val ignoreHidden = musicSettings.ignoreHidden
|
||||||
|
|
||||||
val currentRevision = musicSettings.revision
|
val currentRevision = musicSettings.revision
|
||||||
val newRevision = currentRevision?.takeIf { withCache } ?: UUID.randomUUID()
|
val newRevision = currentRevision?.takeIf { withCache } ?: UUID.randomUUID()
|
||||||
val cache = if (withCache) storedCache.visible() else storedCache.invisible()
|
val cache = if (withCache) storedCache.visible() else storedCache.invisible()
|
||||||
val covers = settingCovers.create(context, newRevision)
|
val covers = settingCovers.create(context, newRevision)
|
||||||
val storage = Storage(cache, covers, storedPlaylists)
|
val storage = Storage(cache, covers, storedPlaylists)
|
||||||
val interpretation = Interpretation(nameFactory, separators)
|
val interpretation = Interpretation(nameFactory, separators, ignoreHidden)
|
||||||
|
|
||||||
val result =
|
val result =
|
||||||
Musikr.new(context, storage, interpretation).run(locations, ::emitIndexingProgress)
|
Musikr.new(context, storage, interpretation).run(locations, ::emitIndexingProgress)
|
||||||
|
|
|
@ -40,6 +40,8 @@ interface MusicSettings : Settings<MusicSettings.Listener> {
|
||||||
var musicLocations: List<MusicLocation>
|
var musicLocations: List<MusicLocation>
|
||||||
/** Whether to exclude non-music audio files from the music library. */
|
/** Whether to exclude non-music audio files from the music library. */
|
||||||
val excludeNonMusic: Boolean
|
val excludeNonMusic: Boolean
|
||||||
|
/** Whether to ignore hidden files and directories during music loading. */
|
||||||
|
val ignoreHidden: Boolean
|
||||||
/** Whether to be actively watching for changes in the music library. */
|
/** Whether to be actively watching for changes in the music library. */
|
||||||
val shouldBeObserving: Boolean
|
val shouldBeObserving: Boolean
|
||||||
/** A [String] of characters representing the desired characters to denote multi-value tags. */
|
/** A [String] of characters representing the desired characters to denote multi-value tags. */
|
||||||
|
@ -90,6 +92,9 @@ class MusicSettingsImpl @Inject constructor(@ApplicationContext private val cont
|
||||||
override val excludeNonMusic: Boolean
|
override val excludeNonMusic: Boolean
|
||||||
get() = sharedPreferences.getBoolean(getString(R.string.set_key_exclude_non_music), true)
|
get() = sharedPreferences.getBoolean(getString(R.string.set_key_exclude_non_music), true)
|
||||||
|
|
||||||
|
override val ignoreHidden: Boolean
|
||||||
|
get() = sharedPreferences.getBoolean(getString(R.string.set_key_ignore_hidden), true)
|
||||||
|
|
||||||
override val shouldBeObserving: Boolean
|
override val shouldBeObserving: Boolean
|
||||||
get() = sharedPreferences.getBoolean(getString(R.string.set_key_observing), false)
|
get() = sharedPreferences.getBoolean(getString(R.string.set_key_observing), false)
|
||||||
|
|
||||||
|
@ -116,7 +121,9 @@ class MusicSettingsImpl @Inject constructor(@ApplicationContext private val cont
|
||||||
listener.onMusicLocationsChanged()
|
listener.onMusicLocationsChanged()
|
||||||
}
|
}
|
||||||
getString(R.string.set_key_separators),
|
getString(R.string.set_key_separators),
|
||||||
getString(R.string.set_key_auto_sort_names) -> {
|
getString(R.string.set_key_auto_sort_names),
|
||||||
|
getString(R.string.set_key_ignore_hidden),
|
||||||
|
getString(R.string.set_key_exclude_non_music) -> {
|
||||||
L.d("Dispatching indexing setting change for $key")
|
L.d("Dispatching indexing setting change for $key")
|
||||||
listener.onIndexingSettingChanged()
|
listener.onIndexingSettingChanged()
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,5 +67,14 @@ class MusicPreferenceFragment : BasePreferenceFragment(R.xml.preferences_music)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (preference.key == getString(R.string.set_key_ignore_hidden)) {
|
||||||
|
L.d("Configuring ignore hidden files setting")
|
||||||
|
preference.onPreferenceChangeListener =
|
||||||
|
Preference.OnPreferenceChangeListener { _, _ ->
|
||||||
|
L.d("Ignore hidden files setting changed, reloading music")
|
||||||
|
musicModel.refresh()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,12 @@
|
||||||
app:key="@string/set_key_exclude_non_music"
|
app:key="@string/set_key_exclude_non_music"
|
||||||
app:summary="@string/set_exclude_non_music_desc"
|
app:summary="@string/set_exclude_non_music_desc"
|
||||||
app:title="@string/set_exclude_non_music" />
|
app:title="@string/set_exclude_non_music" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:key="@string/set_key_ignore_hidden"
|
||||||
|
app:summary="@string/set_ignore_hidden_desc"
|
||||||
|
app:title="@string/set_ignore_hidden" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.settings.ui.WrappedDialogPreference
|
<org.oxycblt.auxio.settings.ui.WrappedDialogPreference
|
||||||
app:key="@string/set_key_separators"
|
app:key="@string/set_key_separators"
|
||||||
|
@ -50,4 +56,4 @@
|
||||||
app:title="@string/set_square_covers" />
|
app:title="@string/set_square_covers" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
Loading…
Reference in a new issue