Dave, you might, but here is the issue:
since it works directly on folders of tracks, it makes sense to use it in the Finder, but not really from within kJams. I mean, how would you even select the folder to process? Also, if you DID use it from within kJams, kJams would immediately lose track of all the tracks, because now they are zipped out from under it!
It was really written as a pre-import processor.
karaoke archiver
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: karaoke archiver
Last edited by DeusExMachina on Thu Apr 23, 2015 12:07 pm, edited 1 time in total.
Re: karaoke archiver
You're right. I am running it as a Service rather than a Folder Action. It is receiving the list of files in the folder and the results consist of the full path of the zip file (echo "$FILEPATH"), the file to be compressed (echo "$f") and the results of the zip action indicating compression %. This is repeated for each file and ignored by the final Growl notification. Perhaps adding a 'return (null)' of some sort at the end might stop the error? Like I said. The files compress fine before the error.
Your original script works fine except that parsing the extension in that fashion fails to recognize files with periods within the name of the file (IE: middle initial). The changes I made, uses only the text after the final period resulting in the correct extension and all text before the final period for the correct path.
Las Vegas
Your original script works fine except that parsing the extension in that fashion fails to recognize files with periods within the name of the file (IE: middle initial). The changes I made, uses only the text after the final period resulting in the correct extension and all text before the final period for the correct path.
Las Vegas
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: karaoke archiver
Oh, I misunderstood. Thought it was failing at the script, not after. I'll do some research.
Could you post some exemplar output? The issue is clearly in how Automator perceived the output vs. running independently so that is where the clues will be.
A(lso, since kJams is going to replace the period in the file name anyway, another solution would have been to preprocess the file names to remove them, but that is not an issue now.)
But as a work around, you could always enclose the shell script in a try block.
try
shell script code
on error
error code
end try
Could you post some exemplar output? The issue is clearly in how Automator perceived the output vs. running independently so that is where the clues will be.
A(lso, since kJams is going to replace the period in the file name anyway, another solution would have been to preprocess the file names to remove them, but that is not an issue now.)
But as a work around, you could always enclose the shell script in a try block.
try
shell script code
on error
error code
end try
Re: karaoke archiver
Yep! That solved it. Just ignore the error. I just replaced the last line of the 'if' loop with:DeusExMachina wrote:But as a work around, you could always enclose the shell script in a try block.
Code: Select all
fi >/dev/null
Las Vegas
-
- Posts: 1293
- Joined: Sun Apr 20, 2008 9:57 am
- Location: Pittsburgh, PA
- Contact:
Re: karaoke archiver
feel free to post your changes in /Code.
Re: karaoke archiver
Sorry. I have no idea how to do that...DeusExMachina wrote:feel free to post your changes in /Code.
LasVegas
Re: karaoke archiver
just post it here
Re: karaoke archiver
The full code to replace the script in Automator is:
LasVegas
Code: Select all
for f in "$@"
do
FILETYPE="${f##*.}"
MP=mp3
CDG=cdg
if ( [ "$FILETYPE" = "$MP" ] || [ "$FILETYPE" = "$CDG" ] );
then
FILEPATH="${f%.*}.zip"
echo "$FILEPATH"
echo "$f"
zip -j -m "$FILEPATH" "$f";
fi >/dev/null
done