mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 01:53:31 +01:00
Add logging for hook plugin
This commit is contained in:
parent
1378351c07
commit
8fea1e65c5
1 changed files with 6 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ import sys
|
|||
from beets.plugins import BeetsPlugin
|
||||
|
||||
|
||||
def create_hook_function(command, shell, substitute_args):
|
||||
def create_hook_function(log, event, command, shell, substitute_args):
|
||||
|
||||
# TODO: Find a better way of piping STDOUT/STDERR/STDIN between the process
|
||||
# and the user.
|
||||
|
|
@ -47,6 +47,8 @@ def create_hook_function(command, shell, substitute_args):
|
|||
unicode(kwargs[key],
|
||||
"utf-8"))
|
||||
|
||||
log.debug('Running command {0} for event {1}', hook_command, event)
|
||||
|
||||
process = subprocess.Popen(hook_command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
|
|
@ -98,8 +100,8 @@ class HookPlugin(BeetsPlugin):
|
|||
substitute_args = {}
|
||||
|
||||
hook_command = hook_command.replace(original, hook_event)
|
||||
hook_function = create_hook_function(hook_command,
|
||||
shell,
|
||||
substitute_args)
|
||||
hook_function = create_hook_function(self._log, hook_event,
|
||||
hook_command, shell,
|
||||
substitute_args)
|
||||
|
||||
self.register_listener(hook_event, hook_function)
|
||||
|
|
|
|||
Loading…
Reference in a new issue