Skip to content

Run commands on imported music files #4265

Answered by jackwilsdon
df-a asked this question in Q&A
Discussion options

You must be logged in to vote

hook doesn't run commands in a shell, so if your configuration looks like this:

hook:
  hooks:
    - event: album_imported
      command: cd '{album.path}' && app1 -x * && app2 file.wma > file.ext

The command that is running is cd with the arguments '{album.path}' && app1 -x * && app2 file.wma > file.ext. To run multiple commands sequentially you'll want to run them in a shell.

command: sh -c 'cd "$0" && app1 -x * && app2 file.wma > file.ext' {album.path}

In terms of "safe" filenames - hook passes the arguments straight into the command without going through a shell, so they don't need any escaping. If you want to run in a shell, you'll need to pass arguments in like above.

I don't thin…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sampsyo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants