Error processing shell script

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Error processing shell script Sun Oct 25, 2015 6:55 pm • by ihavenoidea
I am having trouble passing scoped files from Hazel into a shell script.

I want to strip album art from incoming mps's, I have found a python application that I can run like "eyed3 filename.mp3 --remove-tags" that does what I want, but when setting up a rule to search for .mp3's and run 'embedded shell script' I always get failures.

Here is my actual shell script:
Code: Select all
/usr/local/bin/eyed3 "$1" --remove-frame APIC


I have turned on debug logging and they arent very helpful either:
2015-10-25 22:47:34.553 hazelworker[12170] Example Artist - Example Title.mp3: Rule Strip Tags matched.
2015-10-25 22:47:34.553 hazelworker[12170] DEBUG: Got error last time. Re-trying actions.
2015-10-25 22:47:34.858 hazelworker[12170] DEBUG: == script output ==

== End script output ==
2015-10-25 22:47:34.859 hazelworker[12170] [Error] Shell script failed: Error processing shell script on file /Volumes/Data HD/Music/Staging/artist/2015-10-01/Example Artist - Example Title.mp3.
2015-10-25 22:47:34.859 hazelworker[12170] Shellscript exited with non-successful status code: 1
2015-10-25 22:47:34.859 hazelworker[12170] DEBUG: Tapping error retry sequence


I have tested the script in the CLI and it does work, but I'm not sure why it doesnt work through the embedded shell in Hazel.

Any help would be appreciated it!
Last edited by ihavenoidea on Mon Oct 26, 2015 5:19 pm, edited 1 time in total.
ihavenoidea
 
Posts: 2
Joined: Sun Oct 25, 2015 6:38 pm

Re: Error processing shell script Mon Oct 26, 2015 3:07 pm • by Mr_Noodle
Try referring to $1 instead of $file as the argument passed in by Hazel.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Error processing shell script Mon Oct 26, 2015 5:19 pm • by ihavenoidea
Mr_Noodle wrote:Try referring to $1 instead of $file as the argument passed in by Hazel.


Sorry that was a mistake when I wrote out the command in the post, it is actually $1.

I have watched the actual log files this time when adding a file that matches my rule and have seen this error line:

2015-10-26 21:27:46.382 hazelworker[13398] DEBUG: == script output ==
file not found: /Volumes/Data

== End script output ==


The volume its referring to is called 'Data HD', could it be that its not escaping the spaces? Even if it is I'm not sure why its not because I have wrapped the path in double quotes and single quotes but no luck.

UPDATE:
Okay so I've gone about it a different way which seems to be working now:
Code: Select all
file=$1
/usr/local/bin/eyed3 "${file}" --remove-frame APIC
ihavenoidea
 
Posts: 2
Joined: Sun Oct 25, 2015 6:38 pm

Re: Error processing shell script Tue Oct 27, 2015 11:15 am • by Mr_Noodle
I think just using "$1" (with the quotes around it) directly should work. Give that a try.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support