diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index 3f597dcc1..2c1ccd52f 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -1096,7 +1096,6 @@ class ReplayGainPlugin(BeetsPlugin): # FIXME: Consider renaming the configuration option and deprecating the # old name 'overwrite'. self.force_on_import = self.config['overwrite'].get(bool) - self.per_disc = self.config['per_disc'].get(bool) # Remember which backend is used for CLI feedback self.backend_name = self.config['backend'].as_str() @@ -1234,7 +1233,7 @@ class ReplayGainPlugin(BeetsPlugin): self._log.info('analyzing {0}', album) discs = {} - if self.per_disc: + if self.config['per_disc'].get(bool): for item in album.items(): if discs.get(item.disc) is None: discs[item.disc] = [] diff --git a/test/test_replaygain.py b/test/test_replaygain.py index 73345261d..e63034a26 100644 --- a/test/test_replaygain.py +++ b/test/test_replaygain.py @@ -169,6 +169,18 @@ class ReplayGainCliTestBase(TestHelper): self.assertNotEqual(gain_relative_to_84, gain_relative_to_89) + def test_per_disc(self): + # Use the per_disc option and add a little more concurrency. + album = self._add_album(track_count=4, disc_count=3) + self.config['replaygain']['per_disc'] = True + self.run_command('replaygain', '-a') + + # FIXME: Add fixtures with known track/album gain (within a suitable + # tolerance) so that we can actually check per-disc operation here. + for item in album.items(): + self.assertIsNotNone(item.rg_track_gain) + self.assertIsNotNone(item.rg_album_gain) + @unittest.skipIf(not GST_AVAILABLE, 'gstreamer cannot be found') class ReplayGainGstCliTest(ReplayGainCliTestBase, unittest.TestCase):