music: add setting to hide collaborators
Add a setting to hide "collaborators", that is artists that do not show up on any album artist tags. This is mostly for my own use since I don't get use from useless collaborator entries.
This commit is contained in:
parent
daf1cf8590
commit
1cf1451aef
8 changed files with 57 additions and 20 deletions
|
@ -7,6 +7,7 @@
|
||||||
- Added support for multiple artists
|
- Added support for multiple artists
|
||||||
- Added support for multiple genres
|
- Added support for multiple genres
|
||||||
- Artists and album artists are now both given UI entires
|
- Artists and album artists are now both given UI entires
|
||||||
|
- Added setting to hide "collaborator" artists
|
||||||
- Upgraded music ID management:
|
- Upgraded music ID management:
|
||||||
- Added support for MusicBrainz IDs (MBIDs)
|
- Added support for MusicBrainz IDs (MBIDs)
|
||||||
- Use the more unique MD5 hash of metadata when MBIDs can't be used
|
- Use the more unique MD5 hash of metadata when MBIDs can't be used
|
||||||
|
|
|
@ -141,7 +141,15 @@ class HomeViewModel(application: Application) :
|
||||||
logD("Library changed, refreshing library")
|
logD("Library changed, refreshing library")
|
||||||
_songs.value = settings.libSongSort.songs(library.songs)
|
_songs.value = settings.libSongSort.songs(library.songs)
|
||||||
_albums.value = settings.libAlbumSort.albums(library.albums)
|
_albums.value = settings.libAlbumSort.albums(library.albums)
|
||||||
_artists.value = settings.libArtistSort.artists(library.artists)
|
|
||||||
|
_artists.value = settings.libArtistSort.artists(
|
||||||
|
if (settings.shouldHideCollaborators) {
|
||||||
|
library.artists.filter { !it.isCollaborator }
|
||||||
|
} else {
|
||||||
|
library.artists
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
_genres.value = settings.libGenreSort.genres(library.genres)
|
_genres.value = settings.libGenreSort.genres(library.genres)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +159,10 @@ class HomeViewModel(application: Application) :
|
||||||
tabs = visibleTabs
|
tabs = visibleTabs
|
||||||
_shouldRecreateTabs.value = true
|
_shouldRecreateTabs.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key == application.getString(R.string.set_key_hide_collaborators)) {
|
||||||
|
onLibraryChanged(musicStore.library)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
|
|
|
@ -590,6 +590,9 @@ constructor(raw: Raw, songAlbums: List<Music>) : MusicParent() {
|
||||||
/** The albums of this artist. This will never be empty. */
|
/** The albums of this artist. This will never be empty. */
|
||||||
val albums: List<Album>
|
val albums: List<Album>
|
||||||
|
|
||||||
|
/** Whether this artist is not credited on any albums. */
|
||||||
|
val isCollaborator: Boolean
|
||||||
|
|
||||||
private lateinit var genres: List<Genre>
|
private lateinit var genres: List<Genre>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -617,6 +620,8 @@ constructor(raw: Raw, songAlbums: List<Music>) : MusicParent() {
|
||||||
val distinctSongs = mutableSetOf<Song>()
|
val distinctSongs = mutableSetOf<Song>()
|
||||||
val distinctAlbums = mutableSetOf<Album>()
|
val distinctAlbums = mutableSetOf<Album>()
|
||||||
|
|
||||||
|
var noAlbums = true
|
||||||
|
|
||||||
for (music in songAlbums) {
|
for (music in songAlbums) {
|
||||||
when (music) {
|
when (music) {
|
||||||
is Song -> {
|
is Song -> {
|
||||||
|
@ -628,6 +633,7 @@ constructor(raw: Raw, songAlbums: List<Music>) : MusicParent() {
|
||||||
is Album -> {
|
is Album -> {
|
||||||
music._link(this)
|
music._link(this)
|
||||||
distinctAlbums.add(music)
|
distinctAlbums.add(music)
|
||||||
|
noAlbums = false
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> error("Unexpected input music ${music::class.simpleName}")
|
else -> error("Unexpected input music ${music::class.simpleName}")
|
||||||
|
@ -636,6 +642,7 @@ constructor(raw: Raw, songAlbums: List<Music>) : MusicParent() {
|
||||||
|
|
||||||
songs = distinctSongs.toList()
|
songs = distinctSongs.toList()
|
||||||
albums = distinctAlbums.toList()
|
albums = distinctAlbums.toList()
|
||||||
|
isCollaborator = noAlbums
|
||||||
durationMs = songs.sumOf { it.durationMs }.nonZeroOrNull()
|
durationMs = songs.sumOf { it.durationMs }.nonZeroOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,10 @@ class Date private constructor(private val tokens: List<Int>) : Comparable<Date>
|
||||||
TemporalQueries.localDate()
|
TemporalQueries.localDate()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// When it comes to songs, we only want to show the month and year. This
|
||||||
|
// cannot be done with DateUtils due to it's dynamic nature, so instead
|
||||||
|
// it's done with the built-in date formatter. Since the legacy date API
|
||||||
|
// is awful, we only use instant and limit it to Android 8 onwards.
|
||||||
temporal.atStartOfDay(ZoneId.systemDefault())
|
temporal.atStartOfDay(ZoneId.systemDefault())
|
||||||
.format(DateTimeFormatter.ofPattern("MMM yyyy", Locale.getDefault()))
|
.format(DateTimeFormatter.ofPattern("MMM yyyy", Locale.getDefault()))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -204,9 +204,9 @@ class Settings(private val context: Context, private val callback: Callback? = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The strategy used when loading images. */
|
/** Whether to hide collaborator artists or not. */
|
||||||
val coverMode: CoverMode
|
val shouldHideCollaborators: Boolean
|
||||||
get() = CoverMode.fromIntCode(inner.getInt(context.getString(R.string.set_key_cover_mode), Int.MIN_VALUE)) ?: CoverMode.MEDIA_STORE
|
get() = inner.getBoolean(context.getString(R.string.set_key_hide_collaborators), false)
|
||||||
|
|
||||||
/** Whether to round additional UI elements (including album covers) */
|
/** Whether to round additional UI elements (including album covers) */
|
||||||
val roundMode: Boolean
|
val roundMode: Boolean
|
||||||
|
@ -296,6 +296,10 @@ class Settings(private val context: Context, private val callback: Callback? = n
|
||||||
val shouldBeObserving: Boolean
|
val shouldBeObserving: Boolean
|
||||||
get() = inner.getBoolean(context.getString(R.string.set_key_observing), false)
|
get() = inner.getBoolean(context.getString(R.string.set_key_observing), false)
|
||||||
|
|
||||||
|
/** The strategy used when loading images. */
|
||||||
|
val coverMode: CoverMode
|
||||||
|
get() = CoverMode.fromIntCode(inner.getInt(context.getString(R.string.set_key_cover_mode), Int.MIN_VALUE)) ?: CoverMode.MEDIA_STORE
|
||||||
|
|
||||||
/** Whether to load all audio files, even ones not considered music. */
|
/** Whether to load all audio files, even ones not considered music. */
|
||||||
val excludeNonMusic: Boolean
|
val excludeNonMusic: Boolean
|
||||||
get() = inner.getBoolean(context.getString(R.string.set_key_exclude_non_music), true)
|
get() = inner.getBoolean(context.getString(R.string.set_key_exclude_non_music), true)
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
<string name="set_key_black_theme" translatable="false">KEY_BLACK_THEME</string>
|
<string name="set_key_black_theme" translatable="false">KEY_BLACK_THEME</string>
|
||||||
<string name="set_key_accent" translatable="false">auxio_accent2</string>
|
<string name="set_key_accent" translatable="false">auxio_accent2</string>
|
||||||
|
|
||||||
<string name="set_key_lib_tabs" translatable="false">auxio_lib_tabs</string>
|
<string name="set_key_reindex" translatable="false">auxio_reindex</string>
|
||||||
|
<string name="set_key_observing" translatable="false">auxio_observing</string>
|
||||||
|
<string name="set_key_music_dirs" translatable="false">auxio_music_dirs</string>
|
||||||
<string name="set_key_cover_mode" translatable="false">auxio_cover_mode</string>
|
<string name="set_key_cover_mode" translatable="false">auxio_cover_mode</string>
|
||||||
<string name="set_key_round_mode" translatable="false">auxio_round_covers</string>
|
<string name="set_key_music_dirs_include" translatable="false">auxio_include_dirs</string>
|
||||||
<string name="set_key_bar_action" translatable="false">auxio_bar_action</string>
|
<string name="set_key_exclude_non_music" translatable="false">auxio_exclude_non_music</string>
|
||||||
<string name="set_key_notif_action" translatable="false">auxio_notif_action</string>
|
<string name="set_key_separators" translatable="false">auxio_separators</string>
|
||||||
|
|
||||||
<string name="set_key_headset_autoplay" translatable="false">auxio_headset_autoplay</string>
|
<string name="set_key_headset_autoplay" translatable="false">auxio_headset_autoplay</string>
|
||||||
<string name="set_key_replay_gain" translatable="false">auxio_replay_gain</string>
|
<string name="set_key_replay_gain" translatable="false">auxio_replay_gain</string>
|
||||||
|
@ -26,12 +28,11 @@
|
||||||
<string name="set_key_wipe_state" translatable="false">auxio_wipe_state</string>
|
<string name="set_key_wipe_state" translatable="false">auxio_wipe_state</string>
|
||||||
<string name="set_key_restore_state" translatable="false">auxio_restore_state</string>
|
<string name="set_key_restore_state" translatable="false">auxio_restore_state</string>
|
||||||
|
|
||||||
<string name="set_key_reindex" translatable="false">auxio_reindex</string>
|
<string name="set_key_lib_tabs" translatable="false">auxio_lib_tabs</string>
|
||||||
<string name="set_key_observing" translatable="false">auxio_observing</string>
|
<string name="set_key_hide_collaborators" translatable="false">auxio_hide_collaborators</string>
|
||||||
<string name="set_key_music_dirs" translatable="false">auxio_music_dirs</string>
|
<string name="set_key_round_mode" translatable="false">auxio_round_covers</string>
|
||||||
<string name="set_key_music_dirs_include" translatable="false">auxio_include_dirs</string>
|
<string name="set_key_bar_action" translatable="false">auxio_bar_action</string>
|
||||||
<string name="set_key_exclude_non_music" translatable="false">auxio_exclude_non_music</string>
|
<string name="set_key_notif_action" translatable="false">auxio_notif_action</string>
|
||||||
<string name="set_key_separators" translatable="false">auxio_separators</string>
|
|
||||||
|
|
||||||
<string name="set_key_search_filter" translatable="false">KEY_SEARCH_FILTER</string>
|
<string name="set_key_search_filter" translatable="false">KEY_SEARCH_FILTER</string>
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,8 @@
|
||||||
<string name="set_display">Display</string>
|
<string name="set_display">Display</string>
|
||||||
<string name="set_lib_tabs">Library tabs</string>
|
<string name="set_lib_tabs">Library tabs</string>
|
||||||
<string name="set_lib_tabs_desc">Change visibility and order of library tabs</string>
|
<string name="set_lib_tabs_desc">Change visibility and order of library tabs</string>
|
||||||
|
<string name="set_hide_collaborators">Hide collaborators</string>
|
||||||
|
<string name="set_hide_collaborators_desc">Only show artists that appear in the \'album artist\' tags in your library</string>
|
||||||
<string name="set_cover_mode">Album covers</string>
|
<string name="set_cover_mode">Album covers</string>
|
||||||
<string name="set_cover_mode_off">Off</string>
|
<string name="set_cover_mode_off">Off</string>
|
||||||
<string name="set_cover_mode_media_store">Fast</string>
|
<string name="set_cover_mode_media_store">Fast</string>
|
||||||
|
|
|
@ -31,12 +31,11 @@
|
||||||
app:summary="@string/set_lib_tabs_desc"
|
app:summary="@string/set_lib_tabs_desc"
|
||||||
app:title="@string/set_lib_tabs" />
|
app:title="@string/set_lib_tabs" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.settings.prefs.IntListPreference
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="@integer/cover_mode_media_store"
|
app:key="@string/set_key_hide_collaborators"
|
||||||
app:entries="@array/entries_cover_mode"
|
app:summary="@string/set_hide_collaborators_desc"
|
||||||
app:entryValues="@array/values_cover_mode"
|
app:title="@string/set_hide_collaborators"
|
||||||
app:key="@string/set_key_cover_mode"
|
app:defaultValue="false" />
|
||||||
app:title="@string/set_cover_mode" />
|
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
|
@ -147,6 +146,13 @@
|
||||||
app:summary="@string/set_observing_desc"
|
app:summary="@string/set_observing_desc"
|
||||||
app:title="@string/set_observing" />
|
app:title="@string/set_observing" />
|
||||||
|
|
||||||
|
<org.oxycblt.auxio.settings.prefs.IntListPreference
|
||||||
|
app:defaultValue="@integer/cover_mode_media_store"
|
||||||
|
app:entries="@array/entries_cover_mode"
|
||||||
|
app:entryValues="@array/values_cover_mode"
|
||||||
|
app:key="@string/set_key_cover_mode"
|
||||||
|
app:title="@string/set_cover_mode" />
|
||||||
|
|
||||||
<org.oxycblt.auxio.settings.prefs.WrappedDialogPreference
|
<org.oxycblt.auxio.settings.prefs.WrappedDialogPreference
|
||||||
app:key="@string/set_key_music_dirs"
|
app:key="@string/set_key_music_dirs"
|
||||||
app:summary="@string/set_dirs_desc"
|
app:summary="@string/set_dirs_desc"
|
||||||
|
|
Loading…
Reference in a new issue