mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
sync: keep every replayGain element's fields
A second <replayGain> element for the same song cleared whatever the first one set, because each field was assigned unconditionally and an absent attribute parses to null. No server is known to split the object across elements, but the merge costs nothing and the alternative loses fields silently. Also covers peaks arriving without gains, which the existing cases did not.
This commit is contained in:
@@ -210,10 +210,10 @@ internal class SongDraft(
|
||||
}
|
||||
|
||||
fun addReplayGain(attrs: Attributes) {
|
||||
trackGain = attrs.floatAttr("trackGain")
|
||||
albumGain = attrs.floatAttr("albumGain")
|
||||
trackPeak = attrs.floatAttr("trackPeak")
|
||||
albumPeak = attrs.floatAttr("albumPeak")
|
||||
attrs.floatAttr("trackGain")?.let { trackGain = it }
|
||||
attrs.floatAttr("albumGain")?.let { albumGain = it }
|
||||
attrs.floatAttr("trackPeak")?.let { trackPeak = it }
|
||||
attrs.floatAttr("albumPeak")?.let { albumPeak = it }
|
||||
}
|
||||
|
||||
fun toSong(): Song =
|
||||
|
||||
Reference in New Issue
Block a user