Skip to content

Commit

Permalink
Merge pull request #3816 from ybnd/parallel-replaygain-fix-import-write
Browse files Browse the repository at this point in the history
Fix logic for replaygain auto-compute on import
  • Loading branch information
sampsyo authored Dec 21, 2020
2 parents 4822215 + 12db40f commit 206b1c1
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions beetsplug/replaygain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,8 @@ def close_pool(self):
def import_begin(self, session):
"""Handle `import_begin` event -> open pool
"""
self.open_pool(self.config['threads'].get(int))
if self.config['auto']:
self.open_pool(self.config['threads'].get(int))

def import_end(self, paths):
"""Handle `import` event -> close pool
Expand All @@ -1563,10 +1564,19 @@ def import_end(self, paths):
def imported(self, session, task):
"""Add replay gain info to items or albums of ``task``.
"""
if task.is_album:
self.handle_album(task.album, False)
else:
self.handle_track(task.item, False)
if self.config['auto']:
if task.is_album:
self.handle_album(
task.album,
self.config['auto'].get(bool),
self.config['overwrite'].get(bool)
)
else:
self.handle_track(
task.item,
self.config['auto'].get(bool),
self.config['overwrite'].get(bool)
)

def commands(self):
"""Return the "replaygain" ui subcommand.
Expand Down

0 comments on commit 206b1c1

Please sign in to comment.