karaoke archiver

Just talk about kJams stuff with each other, describe things you did that worked, talk about your setup, anything that doesn't fit into the other forums!
dave
Site Admin
Posts: 6684
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: karaoke archiver

Post by dave »

that just gets you stuck in an infinite loop
click "java served up"
Also, where should I post the BASH script/archiver workflow.
make a new link (page) off the open source page

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

OK, done!

karaokeArchiver

dizzidecazz
Posts: 22
Joined: Wed Feb 17, 2010 8:00 pm

Re: karaoke archiver

Post by dizzidecazz »

Mark,

I still can't get this to work. Tried running as an application, as a plug-in and it ticks a way for a bit, ends and nothing has been zipped.

I tried changing the automator to 'Ask For Finder Items' and point to my folder when prompted and ran it from inside Automator. It gets to the Script and throws back an error, "The action “Run Shell Script” encountered an error. Check the actionʼs properties and try running the workflow again.".

Some things to note, when I load the workflow you attached I get the following errors,

"The Action "Get Selected Finder Items" could not be loaded because it could not be located, try reinstalling the action"
"The workflow was saved with a newer version of the action "Rename Finder Items". Some behaviour might have changed.
"The action "Show Growl Notification" could not be loaded because it could not be located."

When I try to follow the instructions you provided to create the workflow, the options in run shell script only offers "/bin/bash" not "usr/bin/BASH" as in your instructions.

I just tried again as I'm writing this time, I used the 'Get selected Finder Items' action. It ran and got to the Script then just spit me out of Automator with no errors or warning. Arrgghh... I think I might just give up and leave them as seperate files.

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

OK, first off, make sure you actually have a folder selected before you run the script.
Assuming you are doing that, in reverse order:
bin/bash is fine.
You can safely remove the growl notification, it does not affect the final outcome.
Same with Rename, though you can fix it by just dragging a new one over and setting it up the same.
It is very weird that it could not find "Get Selected Finder Items," are you running Snow Leopard? Either way, just drag a new one over.

That said, you appear to have that part running.

I suspect that you are running it with no folder selected. What do the results from each action show?
Last edited by DeusExMachina on Sun May 23, 2010 11:55 am, edited 1 time in total.

dave
Site Admin
Posts: 6684
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: karaoke archiver

Post by dave »

:shock:

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

@DIZZIDECAZZ
Did you ever get my script to work?

dave
Site Admin
Posts: 6684
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: karaoke archiver

Post by dave »

diz?

dizzidecazz
Posts: 22
Joined: Wed Feb 17, 2010 8:00 pm

Re: karaoke archiver

Post by dizzidecazz »

Hi Guys,

Sorry I haven't been around here for a while. Karaoke is a lounge room obsession, whilst my real job has taken precedent lately.

The short answer is 'no', as is the long the answer. :roll:

I'm running OSX 10.5.8, not SL. Is this the part where I find out I have to fork out for SL?

Thanks for your help.

Diz

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

It should work fine in 10.5. I wrote it originally in 10.5. I will have to investigate further.

LasVegas
Posts: 14
Joined: Sun Oct 12, 2014 12:51 pm

Re: karaoke archiver

Post by LasVegas »

DeusExMachina,

I know this is a very old thread, but I really need this script to work in 10.10 (Yosemite). The problem I had was that with the code, as written, any songs with periods within the name fail to compress. I modified the code as follows:

Code: Select all

for f in "$@"
do
	FILETYPE="${f##*.}"	
MP=mp3
CDG=cdg
	if ( [ "$FILETYPE" = "$MP" ] || [ "$FILETYPE" = "$CDG" ] );
	then
		FILEPATH="${f%.*}"
		echo "$FILEPATH"
		echo "$f"
		zip -j -m "$FILEPATH" "$f";
	fi
done
This works, except that any songs with periods within the filename now are not given the '.zip' extension. The files compress fine but just without the extension! Help!

LasVegas

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

Hmm, haven't looked at those in a long time. I'll see what I can see.

LasVegas
Posts: 14
Joined: Sun Oct 12, 2014 12:51 pm

Re: karaoke archiver

Post by LasVegas »

SOLVED!

It simply required adding '.zip' to the end of FILEPATH used for naming the final zip file:

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
done
This now works (apparently) flawlessly in 10.10 (Yosemite) including those files containing extra periods.

EDIT: Except if run in Folder Services. Then I get the error:
Image
The results are fine and no error occurs if run in Automator...

LasVegas

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

Yes, that should work, and was going to be my first suggestion, but wanted to test first before coming back here.
I'll look into the error when run as a service, but Automator does weird things lately, and seems to not be particularly well kept up by Apple.
Part of the problem on my end is that I have at least five totally different version of this script, in multiple languages (Perl, AppleScript, Bash, etc.) and I'll have to tease out which one is doing what first.

dave
Site Admin
Posts: 6684
Joined: Sun Sep 18, 2005 8:02 am
Location: Seattle
Contact:

Re: karaoke archiver

Post by dave »

might i suggest you switch to Python so you can use the script from directly within kJams, plus have programmatic access to all of kJams?

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

Okay, so, thinking about it a bit, I am wondering why you are saving it as a folder action. The instruction I set up were for use as a service. As designed, it applies to a folder of unzipped tracks. You simply context-click the folder, select Services>Karaoke Archiver and it should process that folder.
Do you have a special folder you drag tracks to, and just want CDG/MP3 pairs to magically zip together? This is not the intended purpose, but I suspect to make it work you need to remove the first Automator action, since you do not need to get the Finder item (it already knows that!).

Edit: okay, now that I reread your post, I see I was misreading it the first time. You are running as a service, not as a folder action. So more examination will be necessary. Since I don't have a folder of unzipped tracks lying around, can you tell me what the output of the script portion of the Automator action was?

Edit 2: On further reflection, pretty sure the issue stems from the shell script getting the wrong input when run as Folder Service. When run from Automator, the input it gets is a list of files (the contents of the folder). I suspect when it is run as a folder action, the input it gets is different (won't know what until I have a chance to actually test) but that might be enough for you to go on to examine it yourself, look at the output from the previous Automator action and the input to the shell script, and figure it out. (My first guess is that it is getting the path to the folder, not a list of the files within.)

FTR: here is what mine looks like:
Window 2015-04-23 at 04.08.06.png
(with a "Speak Text" off the bottom of the window, just to be cute).
Last edited by DeusExMachina on Thu Apr 23, 2015 1:11 am, edited 4 times in total.

Post Reply