I’m trying to create a service in automator, which allows me to add files/folders from Finder directly into my mpd playing queue.
I tried the following, the command runs, but nothing happens.
Could anyone please help?
PS: My music-directory is $HOME/Music/ – if that’s important …
EDIT: The following code works perfectly in bash, but not as service.
for arg in "$@"; do
dir=$(cd -P "$(dirname "$arg")" && pwd)/ || continue
mpc add "${dir#"$HOME/Music/"}$(basename "$arg")"
done