diff options
author | wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> | 2021-03-18 14:58:40 +0100 |
---|---|---|
committer | wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> | 2022-01-22 14:00:32 +0100 |
commit | 6689502854056bb80125e629a0ef67d91a775c9b (patch) | |
tree | ad561844c16213c9ee60c7527c5af74c2465c159 | |
parent | 356a775c5e0f8fad2dbb926fe4d7255f5528ac04 (diff) |
replaygain: rewrite long conditionals in a more imperative manner (2/2)
This is significantly easier to parse (for me, at least).
Also, void building some lists inside of any(...) in the process.
-rw-r--r-- | beetsplug/replaygain.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index ca5f08ad8..c1266f46f 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -1145,8 +1145,9 @@ class ReplayGainPlugin(BeetsPlugin): self._log.info('Skipping album {0}', album) return - if (any([self.should_use_r128(item) for item in album.items()]) and not - all([self.should_use_r128(item) for item in album.items()])): + items_iter = iter(album.items()) + use_r128 = self.should_use_r128(next(items_iter)) + if any(use_r128 != self.should_use_r128(i) for i in items_iter): self._log.error( "Cannot calculate gain for album {0} (incompatible formats)", album) |