From f645400c5e9c834bddd4b0da56a8d59d19e85ceb Mon Sep 17 00:00:00 2001 From: Zsin Skri Date: Tue, 18 Jun 2019 23:17:38 +0200 Subject: [PATCH 1/3] replaygain: adapt to mediafile commit 95e569a Since commit 95e569a, mediafile takes care of the float -> Q7.8 conversion in R128 GAIN tags by itself. From `store_album_r128_gain` this conversion was already missing, remove it from `store_track_r128_gain`, too. fixes #3311 --- beetsplug/replaygain.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index 8e11ee370..90d7ee236 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -901,27 +901,27 @@ class ReplayGainPlugin(BeetsPlugin): item.rg_track_gain = track_gain.gain item.rg_track_peak = track_gain.peak item.store() - - self._log.debug(u'applied track gain {0}, peak {1}', + self._log.debug(u'applied track gain {0} LU, peak {1} of FS', item.rg_track_gain, item.rg_track_peak) - def store_track_r128_gain(self, item, track_gain): - item.r128_track_gain = int(round(track_gain.gain * pow(2, 8))) - item.store() - - self._log.debug(u'applied r128 track gain {0}', item.r128_track_gain) - def store_album_gain(self, item, album_gain): item.rg_album_gain = album_gain.gain item.rg_album_peak = album_gain.peak item.store() - self._log.debug(u'applied album gain {0}, peak {1}', + self._log.debug(u'applied album gain {0} LU, peak {1} of FS', item.rg_album_gain, item.rg_album_peak) + def store_track_r128_gain(self, item, track_gain): + item.r128_track_gain = track_gain.gain + item.store() + + self._log.debug(u'applied r128 track gain {0} LU', + item.r128_track_gain) + def store_album_r128_gain(self, item, album_gain): item.r128_album_gain = album_gain.gain item.store() - self._log.debug(u'applied r128 album gain {0}', + self._log.debug(u'applied r128 album gain {0} LU', item.r128_album_gain) def handle_album(self, album, write, force=False): From a7e2de24998c8127dd1c0317dd7dce57c7cfc601 Mon Sep 17 00:00:00 2001 From: Zsin Skri Date: Thu, 20 Jun 2019 12:49:39 +0200 Subject: [PATCH 2/3] require mediafile 0.2.0 mediafile 0.2.0 includes the changes used by commit f645400. Update setup.py to reflect that new version requirement. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1078d6cc9..cfcffdbf5 100755 --- a/setup.py +++ b/setup.py @@ -91,7 +91,7 @@ setup( 'unidecode', 'musicbrainzngs>=0.4', 'pyyaml', - 'mediafile>=0.1.0', + 'mediafile>=0.2.0', 'confuse>=1.0.0', ] + [ # Avoid a version of munkres incompatible with Python 3. From 299cd01437797b4c49e1354b191680c09c0c4af5 Mon Sep 17 00:00:00 2001 From: Zsin Skri Date: Thu, 20 Jun 2019 22:14:58 +0200 Subject: [PATCH 3/3] changelog: fix storage format in R128_ALBUM_GAIN --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9d5918a2d..7f1d467c2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -48,6 +48,7 @@ Fixes: * :doc:`/plugins/importadded`: Fixed a crash that occurred when the ``after_write`` signal was emitted. :bug:`3301` +* doc:`plugins/replaygain`: Fix storage format in R128_ALBUM_GAIN tags. For plugin developers: