image: make artist images sort by count

Make artist images sort by count instead of by name.

I've recently added a few singles in my library that have been
cluttering the previous artist image algorithm with non-ideal
covers. Instead of sorting by name (Which was really an artifact
of the old MediaStore engine anyway), sort by the amount of songs
of each album instead, which hopefully should weight images less
towards singles and more towards albums (And especially albums
the user likes).
This commit is contained in:
Alexander Capehart 2022-10-30 21:29:59 -06:00
parent d6e747cf39
commit 7c913708f2
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 3 additions and 2 deletions

View file

@ -86,7 +86,8 @@ private constructor(
private val artist: Artist private val artist: Artist
) : BaseFetcher() { ) : BaseFetcher() {
override suspend fun fetch(): FetchResult? { override suspend fun fetch(): FetchResult? {
val albums = Sort(Sort.Mode.ByName, true).albums(artist.albums) // Pick the "most prominent" albums (i.e albums with the most songs) to show in the image.
val albums = Sort(Sort.Mode.ByCount, false).albums(artist.albums)
val results = albums.mapAtMost(4) { album -> fetchCover(context, album) } val results = albums.mapAtMost(4) { album -> fetchCover(context, album) }
return createMosaic(context, results, size) return createMosaic(context, results, size)
} }

View file

@ -170,7 +170,7 @@
<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">Hide collaborators</string>
<string name="set_hide_collaborators_desc">Only show artists that are directly credited on an album</string> <string name="set_hide_collaborators_desc">Only show artists that are directly credited on an album in the 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>