mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 04:55:10 +01:00
replaygain: pass the write flag explicitly
The variable was previously captured by the closure. This is in preparation for moving these nested functions elsewhere.
This commit is contained in:
parent
ad75cbf4a5
commit
9ead9cdbb8
1 changed files with 4 additions and 4 deletions
|
|
@ -1200,7 +1200,7 @@ class ReplayGainPlugin(BeetsPlugin):
|
|||
discs[1] = album.items()
|
||||
|
||||
for discnumber, items in discs.items():
|
||||
def _store_album(task):
|
||||
def _store_album(task, write):
|
||||
if (task.album_gain is None or task.track_gains is None
|
||||
or len(task.track_gains) != len(task.items)):
|
||||
# In some cases, backends fail to produce a valid
|
||||
|
|
@ -1223,7 +1223,7 @@ class ReplayGainPlugin(BeetsPlugin):
|
|||
self._apply(
|
||||
self.backend_instance.compute_album_gain,
|
||||
args=[task], kwds={},
|
||||
callback=_store_album
|
||||
callback=lambda task: _store_album(task, write)
|
||||
)
|
||||
except ReplayGainError as e:
|
||||
self._log.info("ReplayGain error: {0}", e)
|
||||
|
|
@ -1244,7 +1244,7 @@ class ReplayGainPlugin(BeetsPlugin):
|
|||
|
||||
use_r128 = self.should_use_r128(item)
|
||||
|
||||
def _store_track(task):
|
||||
def _store_track(task, write):
|
||||
if task.track_gains is None or len(task.track_gains) != 1:
|
||||
# In some cases, backends fail to produce a valid
|
||||
# `track_gains` without throwing FatalReplayGainError
|
||||
|
|
@ -1264,7 +1264,7 @@ class ReplayGainPlugin(BeetsPlugin):
|
|||
self._apply(
|
||||
self.backend_instance.compute_track_gain,
|
||||
args=[task], kwds={},
|
||||
callback=_store_track
|
||||
callback=lambda task: _store_track(task, write)
|
||||
)
|
||||
except ReplayGainError as e:
|
||||
self._log.info("ReplayGain error: {0}", e)
|
||||
|
|
|
|||
Loading…
Reference in a new issue