mirror of
https://github.com/beetbox/beets.git
synced 2025-12-10 10:32:34 +01:00
Small fixes in replaygain.Bs1770gainBackend and test_replaygain.py
* Fix unspecified `gain_adjustment` when method defined in config * Fix difference between dB and LUFS values in case of mismatched `target_level`/`method`: ``` db_to_lufs( target_level <dB> ) - lufs_to_dB( -23 <LUFS> ) ``` * Ignore single assertion in case of bs1770gain (cherry picked from commit 2395bf224032c44f1ea5d28e0c63af96a92b96df)
This commit is contained in:
parent
c78afb1a97
commit
c1cb78c908
2 changed files with 8 additions and 3 deletions
|
|
@ -249,12 +249,15 @@ class Bs1770gainBackend(Backend):
|
|||
if self.__method != "":
|
||||
# backward compatibility to `method` option
|
||||
method = self.__method
|
||||
gain_adjustment = target_level \
|
||||
- [k for k, v in self.methods.items() if v == method][0]
|
||||
elif target_level in self.methods:
|
||||
method = self.methods[target_level]
|
||||
gain_adjustment = 0
|
||||
else:
|
||||
method = self.methods[-23]
|
||||
gain_adjustment = target_level - lufs_to_db(-23)
|
||||
lufs_target = -23
|
||||
method = self.methods[lufs_target]
|
||||
gain_adjustment = target_level - lufs_target
|
||||
|
||||
# Construct shell command.
|
||||
cmd = [self.command]
|
||||
|
|
|
|||
|
|
@ -151,7 +151,9 @@ class ReplayGainCliTestBase(TestHelper):
|
|||
self.assertEqual(max(gains), min(gains))
|
||||
|
||||
self.assertNotEqual(max(gains), 0.0)
|
||||
self.assertNotEqual(max(peaks), 0.0)
|
||||
if not self.backend == "bs1770gain":
|
||||
# Actually produces peaks == 0.0 ~ self.add_album_fixture
|
||||
self.assertNotEqual(max(peaks), 0.0)
|
||||
|
||||
def test_cli_writes_only_r128_tags(self):
|
||||
if self.backend == "command":
|
||||
|
|
|
|||
Loading…
Reference in a new issue