music: add non-standard artist fields

Add non-standard ARTISTS/ALBUMARTIST fields to reasonable places in the
ID3v2 and Vorbis parsers.

Turns out these are stupidly common when multi-artist information is
used in order to maximize player compatibility. More or less, TPE1 and
ARTIST will be filled in with delimited values, while ARTISTS will be
filled in with native multi-value information.

This is stupid and insane, but I want to prioritize a good out of box
experience without much user fiddling, so I may as well implement
these.

Currently, I'm only adding the non-standard fields that I know exist.
This doesn't include hypothetical but unencountered fields like
TXXX:ALBUMARTISTS.
This commit is contained in:
Alexander Capehart 2023-01-14 20:49:13 -07:00
parent 176f0cc465
commit 5f9169fb78
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 9 additions and 8 deletions

View file

@ -213,7 +213,7 @@ class Task(context: Context, private val raw: Song.Raw) {
// Artist
textFrames["TXXX:musicbrainz artist id"]?.let { raw.artistMusicBrainzIds = it }
textFrames["TPE1"]?.let { raw.artistNames = it }
(textFrames["TXXX:artists"] ?: textFrames["TPE1"])?.let { raw.artistNames = it }
textFrames["TSOP"]?.let { raw.artistSortNames = it }
// Album artist
@ -304,15 +304,16 @@ class Task(context: Context, private val raw: Song.Raw) {
// Artist
comments["musicbrainz_artistid"]?.let { raw.artistMusicBrainzIds = it }
comments["artist"]?.let { raw.artistNames = it }
comments["artistsort"]?.let { raw.artistSortNames = it }
(comments["artists"] ?: comments["artist"])?.let { raw.artistNames = it }
(comments["artists_sort"] ?: comments["artistsort"])?.let { raw.artistSortNames = it }
// Album artist
comments["musicbrainz_albumartistid"]?.let { raw.albumArtistMusicBrainzIds = it }
comments["albumartist"]?.let { raw.albumArtistNames = it }
comments["albumartistsort"]?.let { raw.albumArtistSortNames = it }
(comments["albumartists"] ?: comments["albumartist"])?.let { raw.albumArtistNames = it }
(comments["albumartists_sort"] ?: comments["albumartistsort"])
?.let { raw.albumArtistSortNames = it }
// Genre
comments["GENRE"]?.let { raw.genreNames = it }
comments["genre"]?.let { raw.genreNames = it }
}
}

View file

@ -128,8 +128,8 @@ class QueueFragment : ViewBindingFragment<FragmentQueueBinding>(), EditableListL
binding.queueRecycler.scrollToPosition(scrollTo)
} else if (scrollTo > end) {
// We need to scroll downwards, we need to offset by a screen of songs.
// This does have some error due to what the layout manager returns being
// somewhat mutable. This is considered okay.
// This does have some error due to how many completely visible items on-screen
// can vary. This is considered okay.
binding.queueRecycler.scrollToPosition(
min(queue.lastIndex, scrollTo + (end - start)))
}