music: fix grouping regressions
Fix regressions in grouping, mostly around the kind of music that is prioritized and sort naming.
This commit is contained in:
parent
31d647123f
commit
839861b6b8
4 changed files with 37 additions and 19 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
## dev
|
## dev
|
||||||
|
|
||||||
#### What's Improved
|
#### What's Improved
|
||||||
- Tags formatted as `artistssort` or `albumartistssort` are now recognized by Auxio
|
- `artistssort`, `albumartistssort`, and `album_artists` tags are now recognized
|
||||||
- Non-english digit strings are now sorted better
|
- Non-english digit strings are sorted more correctly
|
||||||
- Reduced visual loading time
|
- Reduced visual loading time
|
||||||
|
|
||||||
#### What's Fixed
|
#### What's Fixed
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
- Fixed selection not updating when playlists are changed
|
- Fixed selection not updating when playlists are changed
|
||||||
- Fixed duplicate albums appearing in certain cases
|
- Fixed duplicate albums appearing in certain cases
|
||||||
- Fixed ReplayGain adjustment not applying at the start of a song in certain cases
|
- Fixed ReplayGain adjustment not applying at the start of a song in certain cases
|
||||||
|
- Music cache is no longer migrated between devices
|
||||||
|
|
||||||
## 3.1.1
|
## 3.1.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,10 @@ import android.net.Uri
|
||||||
/**
|
/**
|
||||||
* Bundle of [Uri] information used in [CoverExtractor] to ensure consistent [Uri] use when loading
|
* Bundle of [Uri] information used in [CoverExtractor] to ensure consistent [Uri] use when loading
|
||||||
* images.
|
* images.
|
||||||
|
*
|
||||||
* @param mediaStore The album cover [Uri] obtained from MediaStore.
|
* @param mediaStore The album cover [Uri] obtained from MediaStore.
|
||||||
* @param song The [Uri] of the first song (by track) of the album, which can also be used to
|
* @param song The [Uri] of the first song (by track) of the album, which can also be used to obtain
|
||||||
* obtain an album cover.
|
* an album cover.
|
||||||
* @author Alexander Capehart (OxygenCobalt)
|
* @author Alexander Capehart (OxygenCobalt)
|
||||||
*/
|
*/
|
||||||
data class CoverUri(val mediaStore: Uri, val song: Uri)
|
data class CoverUri(val mediaStore: Uri, val song: Uri)
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,8 @@ class DeviceLibraryFactoryImpl @Inject constructor(private val musicSettings: Mu
|
||||||
val artistGrouping = mutableMapOf<RawArtist.Key, Grouping<RawArtist, Music>>()
|
val artistGrouping = mutableMapOf<RawArtist.Key, Grouping<RawArtist, Music>>()
|
||||||
val genreGrouping = mutableMapOf<RawGenre.Key, Grouping<RawGenre, SongImpl>>()
|
val genreGrouping = mutableMapOf<RawGenre.Key, Grouping<RawGenre, SongImpl>>()
|
||||||
|
|
||||||
|
// TODO: Use comparators here
|
||||||
|
|
||||||
// All music information is grouped as it is indexed by other components.
|
// All music information is grouped as it is indexed by other components.
|
||||||
for (rawSong in rawSongs) {
|
for (rawSong in rawSongs) {
|
||||||
val song = SongImpl(rawSong, musicSettings)
|
val song = SongImpl(rawSong, musicSettings)
|
||||||
|
|
@ -150,11 +152,13 @@ class DeviceLibraryFactoryImpl @Inject constructor(private val musicSettings: Mu
|
||||||
// Since albums are grouped fuzzily, we pick the song with the earliest track to
|
// Since albums are grouped fuzzily, we pick the song with the earliest track to
|
||||||
// use for album information to ensure consistent metadata and UIDs. Fall back to
|
// use for album information to ensure consistent metadata and UIDs. Fall back to
|
||||||
// the name otherwise.
|
// the name otherwise.
|
||||||
val trackLower =
|
val higherPriority =
|
||||||
song.track != null &&
|
song.track != null &&
|
||||||
(prioritized.track == null || song.track < prioritized.track)
|
(prioritized.track == null ||
|
||||||
val nameLower = song.name < prioritized.name
|
song.track < prioritized.track ||
|
||||||
if (trackLower || nameLower) {
|
(song.track == prioritized.track && song.name < prioritized.name))
|
||||||
|
|
||||||
|
if (higherPriority) {
|
||||||
albumBody.raw = PrioritizedRaw(song.rawAlbum, song)
|
albumBody.raw = PrioritizedRaw(song.rawAlbum, song)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -187,8 +191,8 @@ class DeviceLibraryFactoryImpl @Inject constructor(private val musicSettings: Mu
|
||||||
// Genre information from higher songs in ascending alphabetical order are
|
// Genre information from higher songs in ascending alphabetical order are
|
||||||
// prioritized.
|
// prioritized.
|
||||||
val prioritized = genreBody.raw.src
|
val prioritized = genreBody.raw.src
|
||||||
val nameLower = song.name < prioritized.name
|
val higherPriority = song.name < prioritized.name
|
||||||
if (nameLower) {
|
if (higherPriority) {
|
||||||
genreBody.raw = PrioritizedRaw(rawGenre, song)
|
genreBody.raw = PrioritizedRaw(rawGenre, song)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -217,11 +221,14 @@ class DeviceLibraryFactoryImpl @Inject constructor(private val musicSettings: Mu
|
||||||
// Album information from later dates is prioritized, as it is more
|
// Album information from later dates is prioritized, as it is more
|
||||||
// likely to contain the "modern" name of the artist if the information
|
// likely to contain the "modern" name of the artist if the information
|
||||||
// really is in-consistent. Fall back to the name otherwise.
|
// really is in-consistent. Fall back to the name otherwise.
|
||||||
val dateEarlier =
|
val prioritize =
|
||||||
album.dates != null &&
|
album.dates != null &&
|
||||||
(prioritized.dates == null || album.dates < prioritized.dates)
|
(prioritized.dates == null ||
|
||||||
val nameLower = album.name < prioritized.name
|
album.dates > prioritized.dates ||
|
||||||
if (dateEarlier || nameLower) {
|
(album.dates == prioritized.dates &&
|
||||||
|
album.name < prioritized.name))
|
||||||
|
|
||||||
|
if (prioritize) {
|
||||||
body.raw = PrioritizedRaw(rawArtist, album)
|
body.raw = PrioritizedRaw(rawArtist, album)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -243,6 +250,8 @@ class DeviceLibraryFactoryImpl @Inject constructor(private val musicSettings: Mu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Avoid redundant data creation
|
||||||
|
|
||||||
class DeviceLibraryImpl(
|
class DeviceLibraryImpl(
|
||||||
override val songs: Set<SongImpl>,
|
override val songs: Set<SongImpl>,
|
||||||
override val albums: Set<AlbumImpl>,
|
override val albums: Set<AlbumImpl>,
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,9 @@ private class TagWorkerImpl(
|
||||||
textFrames["TALB"]?.let { rawSong.albumName = it.first() }
|
textFrames["TALB"]?.let { rawSong.albumName = it.first() }
|
||||||
textFrames["TSOA"]?.let { rawSong.albumSortName = it.first() }
|
textFrames["TSOA"]?.let { rawSong.albumSortName = it.first() }
|
||||||
(textFrames["TXXX:musicbrainz album type"]
|
(textFrames["TXXX:musicbrainz album type"]
|
||||||
?: textFrames["TXXX:releasetype"] ?: textFrames["GRP1"])
|
?: textFrames["TXXX:releasetype"] ?:
|
||||||
|
// This is a non-standard iTunes extension
|
||||||
|
textFrames["GRP1"])
|
||||||
?.let { rawSong.releaseTypes = it }
|
?.let { rawSong.releaseTypes = it }
|
||||||
|
|
||||||
// Artist
|
// Artist
|
||||||
|
|
@ -158,15 +160,17 @@ private class TagWorkerImpl(
|
||||||
rawSong.albumArtistNames = it
|
rawSong.albumArtistNames = it
|
||||||
}
|
}
|
||||||
(textFrames["TXXX:albumartistssort"]
|
(textFrames["TXXX:albumartistssort"]
|
||||||
?: textFrames["TXXX:albumartists_sort"] ?: textFrames["TSO2"])
|
?: textFrames["TXXX:albumartists_sort"] ?: textFrames["TXXX:albumartistsort"]
|
||||||
|
// This is a non-standard iTunes extension
|
||||||
|
?: textFrames["TSO2"])
|
||||||
?.let { rawSong.albumArtistSortNames = it }
|
?.let { rawSong.albumArtistSortNames = it }
|
||||||
|
|
||||||
// Genre
|
// Genre
|
||||||
textFrames["TCON"]?.let { rawSong.genreNames = it }
|
textFrames["TCON"]?.let { rawSong.genreNames = it }
|
||||||
|
|
||||||
// Compilation Flag
|
// Compilation Flag
|
||||||
(textFrames["TCMP"]
|
(textFrames["TCMP"] // This is a non-standard itunes extension
|
||||||
?: textFrames["TXXX:compilation"] ?: textFrames["TXXX:itunescompilation"])
|
?: textFrames["TXXX:compilation"] ?: textFrames["TXXX:itunescompilation"])
|
||||||
?.let {
|
?.let {
|
||||||
// Ignore invalid instances of this tag
|
// Ignore invalid instances of this tag
|
||||||
if (it.size != 1 || it[0] != "1") return@let
|
if (it.size != 1 || it[0] != "1") return@let
|
||||||
|
|
@ -175,6 +179,7 @@ private class TagWorkerImpl(
|
||||||
rawSong.albumArtistNames.ifEmpty { COMPILATION_ALBUM_ARTISTS }
|
rawSong.albumArtistNames.ifEmpty { COMPILATION_ALBUM_ARTISTS }
|
||||||
rawSong.releaseTypes = rawSong.releaseTypes.ifEmpty { COMPILATION_RELEASE_TYPES }
|
rawSong.releaseTypes = rawSong.releaseTypes.ifEmpty { COMPILATION_RELEASE_TYPES }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplayGain information
|
// ReplayGain information
|
||||||
textFrames["TXXX:replaygain_track_gain"]?.parseReplayGainAdjustment()?.let {
|
textFrames["TXXX:replaygain_track_gain"]?.parseReplayGainAdjustment()?.let {
|
||||||
rawSong.replayGainTrackAdjustment = it
|
rawSong.replayGainTrackAdjustment = it
|
||||||
|
|
@ -262,7 +267,9 @@ private class TagWorkerImpl(
|
||||||
|
|
||||||
// Album artist
|
// Album artist
|
||||||
comments["musicbrainz_albumartistid"]?.let { rawSong.albumArtistMusicBrainzIds = it }
|
comments["musicbrainz_albumartistid"]?.let { rawSong.albumArtistMusicBrainzIds = it }
|
||||||
(comments["albumartists"] ?: comments["albumartist"])?.let { rawSong.albumArtistNames = it }
|
(comments["albumartists"] ?: comments["album_artists"] ?: comments["albumartist"])?.let {
|
||||||
|
rawSong.albumArtistNames = it
|
||||||
|
}
|
||||||
(comments["albumartistssort"]
|
(comments["albumartistssort"]
|
||||||
?: comments["albumartists_sort"] ?: comments["albumartistsort"])
|
?: comments["albumartists_sort"] ?: comments["albumartistsort"])
|
||||||
?.let { rawSong.albumArtistSortNames = it }
|
?.let { rawSong.albumArtistSortNames = it }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue