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!
DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: karaoke archiver

Post by DeusExMachina »

Apparently the issue is with SL. The old version works just fine in Leopard, and the new version works just fine if you run it inside Automator. It is only if you run it as a stand alone that it throw up the error, but only after it successfully zips everything. Kinda annoying, but at least it works.

P.S. anyone have any idea what happened to folder actions in SL. Why can't I add this as an action for any folder?

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

Re: karaoke archiver

Post by dave »

anyone?

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

Re: karaoke archiver

Post by DeusExMachina »

Yeah, apparently Apple thinks that I should only be able to add automatic actions to folders now. :-/

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

Re: karaoke archiver

Post by dave »

put the script into the folder:
"/Library/Scripts/Folder Action Scripts"

then it should be "available" to pick from the action script list

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

Re: karaoke archiver

Post by DeusExMachina »

Yeah, but that doesn't help me, though, Dave. Used to be I got the "More automator actions" context menu, from which I could then pick my script. Putting it in the Folder Action Scripts folder just lets me assign it as an automatic action. So I cam make a folder that automatically zips karaoke files together that I drag to it. What I want is my workflow to be available from the context menu to apply to any folder I chose on a one time basis. This worked fine in Leopard, but seems to have disappeared in SL.

Bad Apple

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

Re: karaoke archiver

Post by dave »

awww fark!

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

Re: karaoke archiver

Post by DeusExMachina »

Nope, figured it out, and the answer is…
MAGICAL!

(Sorry Steve)

Anyway, the old was in leopard was t make a Finder plug in. These worked OK, but were SLOW as hell to load, and one had to burrow down a few levels in the menu hierarchy to get to them.

In SL they are not "Services" (as in the Services manu.) As such, you can add them system-side. So just open up automator, click on Service in the opening splash screen to create a new Service, open my workflow, copy the items and paste them in to the new Service. Automator will throw you an alert. Don't let it insert a copy files command. At this point automator breaks, and only copies the stuff BEFORE the offending get selected items. So now you have to go back to my workflow, select the item AFTER that, and copy and paste THEM into the new Service. Save. Give it a name (Karaoke Archiver will do nicely, or you could use Mark's amazing, indispensable, and Earth shattering Karaoke Archiver!) and voila, next time you right click a folder, there it is, in the top level of the context menu.
And as an added bonus, it is hyperfast!

Coolnesses.

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

Re: karaoke archiver

Post by DeusExMachina »

Still get that stupid runtime error though.

Bad Apple.

Oh well.

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

Re: karaoke archiver

Post by dave »

somebody package this up and make an installer, please

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

Re: karaoke archiver

Post by DeusExMachina »

I could write an automator script… oh wait.

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

Re: karaoke archiver

Post by DeusExMachina »

So Dave, I have two versions of the script portion. One is as posted, in Perl. The other, and earlier one was in BASH, and is this:
for f in "$@"
do
FILETYPE=`basename "$f"|cut -d"." -f2`
MP=mp3
CDG=cdg
if ( [ "$FILETYPE" = "$MP" ] || [ "$FILETYPE" = "$CDG" ] );
then
FILEPATH=`dirname "$f"`"/"`basename "$f"|cut -d"." -f1`
echo "$FILEPATH"
echo "$f"
zip -j -m "$FILEPATH" "$f";
fi
done

I replaced the shorter BASH script with the Perl script (with some help from a friend) on the advice that it would be faster for large lists of files. Any thoughts on this? (I have not noticed a difference.)

P.S. with the Perl version, remove the Get Folder Contents component of the automator workflow!!! I forgot that part!

OK, I kinda answered my own question. Just tested again, and it turns out, the original version is better. Perl is NOT faster than BASH, contrary to the (former) friend's assertions! in my limited testing BASH zipped the folders in 13 seconds, and Perl took at least 17 (33% faster.) Just goes to show, friends can over think your problems!

That said, I am STILL interested in your opinion on the matter. Is Perl, in general, a faster way to go than BASH?
Last edited by DeusExMachina on Fri May 21, 2010 2:05 pm, edited 1 time in total.

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

Re: karaoke archiver

Post by dave »

i prefer you post code to the wiki

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

Re: karaoke archiver

Post by DeusExMachina »

Dave, please reread. I posted that in an effort to get your opinion on BASH v Perl. Once I have that, I will post the winner of the code wars! :)

P.S. BTW, there is no way to get to the Server code pages other than the link in that forum.
I know because I couldn't figure out where to put THIS code, either!

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

Re: karaoke archiver

Post by dave »

sorry, umm, i have no opinion, or, my opinion is "yes"! or something. i don't know anything about bash/perl pros/cons.

to get to the code pages:
main page->open source button on the right

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

Re: karaoke archiver

Post by DeusExMachina »

Nope, that just gets you stuck in an infinite loop:
Server>Code (look here)>Server

Also, where should I post the BASH script/archiver workflow.

Post Reply