Renaming series

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Re: Renaming series Tue Jul 29, 2008 11:41 am • by Gidgidonihah
Oh. Heh. I didn't even see something like that. As you might have guessed, I'm new and just started poking around. I guess I could poke around with that. But now that I've got it working, if it ain't broke, don't fix it. Am I right?

I'll remember that though when I do decide to go poking around.
Gidgidonihah
 
Posts: 19
Joined: Mon Jul 28, 2008 6:18 pm

Re: Renaming series Tue Jul 29, 2008 12:49 pm • by Laner
I'll try it again with the new function.
Thanks for reminding me, didn't think about it like that :)
Laner
 
Posts: 13
Joined: Tue Mar 06, 2007 3:44 am

Re: Renaming series Mon Aug 18, 2008 7:23 am • by Laner
The matching works. Great jobb!
Now I only need to find out how to rename it according to the matching.
Laner
 
Posts: 13
Joined: Tue Mar 06, 2007 3:44 am

Re: Renaming series Mon Aug 18, 2008 3:59 pm • by Mr_Noodle
For that, look at the Custom Token stuff. You basically want to create a custom token (or several custom tokens) to match the part(s) of the name you want to re-use. Check out the Help section on it and if you need more help, let me know.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming series Tue Oct 14, 2008 12:26 pm • by emmanuel
I started looking at how one might do this today, and I'm a bit perplexed.

Without the Regular Expression concept of look-ahead / look-behind, and particularly alternation, I just don't see how it could be done.

Mr. Noodle, in general terms, how would you go about 'removing' known parts of an unknown filename using the pattern matching capabilities of Hazel 2.2?

I would appreciate pointers on a general strategy.

Thanks,
Emmanuel
emmanuel
 
Posts: 6
Joined: Tue Oct 14, 2008 12:06 pm

Re: Renaming series Wed Oct 15, 2008 12:26 pm • by Mr_Noodle
You should be able to remove things by capturing (using custom tokens) everything around the part you are removing, and then combining those tokens in the rename action.

So if you want to remove the word "sausage", you would do something like

(pre-sausage custom token)sausage(post-sausage custom token)

The pre and post tokens can be set to match anything. In the rename, you would just have:

(pre-sausage custom token)(post-sausage custom token)

If you have a more specific example, post it here.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming series Wed Oct 15, 2008 1:31 pm • by emmanuel
I see. My apologies, I assumed (without testing my assumption), that an "Anything" token would match the entire string, even in the presence of a subsequent token. Your explanation makes good sense, and should make it pretty easy to accomplish what I want to do.

Thank you!
emmanuel
 
Posts: 6
Joined: Tue Oct 14, 2008 12:06 pm

Re: Renaming series Wed Oct 29, 2008 11:40 pm • by AdamPan
Is there any way of symbol stripping, i.e. replacing all periods with spaces?

So
Code: Select all
Two.Word    =>    Two Word
Now_Three_Words    =>    Now Three Words
etc.
AdamPan
 
Posts: 1
Joined: Sat Oct 25, 2008 9:54 pm

Re: Renaming series Thu Oct 30, 2008 1:19 pm • by Gidgidonihah
Yes. There is.

Now don't you wish I were more helpful? I can't say how you do it with hazel's built in matching, but if it's like regular expressions, then you absolutely can.

I am doing something similar, however I'm having hazel run a php script I wrote that does everything. It was just easier for me this way.
Once I get that all cleaned up and working perfectly, I'll post that here in case anybody wants it.
Gidgidonihah
 
Posts: 19
Joined: Mon Jul 28, 2008 6:18 pm

Re: Renaming series Thu Oct 30, 2008 3:06 pm • by Mr_Noodle
Actually, there's no easy way with the built-in pattern stuff. The problem is that the current pattern system applies the whole pattern to the whole text once. The pattern has to account for every character in the text in some form. It doesn't apply the pattern repeatedly.

In regular expression parlance, there's an implicit "^" at the beginning and a "$" at the end of every pattern you enter. Therefore, you can't repeatedly match a pattern and replace it in the same text.

I'll add something in the feature database concerning this but I'm not sure how it will be integrated. Maybe a simple replace text with other text type action. For now, though, an external script is the way to go.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Renaming series Thu Oct 30, 2008 3:22 pm • by Gidgidonihah
Wow. Thanks for the answer on that one, Noodle. I had no idea there wasn't a way.
Just out of curiosity, why haven't you implemented a full blown perl style regex? I understand that you said it was too complicated for the simple user. But really, if they don't understand it, they're not going to use it, are they? That would give the option for those that could.
To me though, it doesn't really matter since I just do the renaming/moving with an external script, so I'm happy.

Like I say, I'll post that here (probably in another topic to branch the discussion) when I get home and get it cleaned up. I'd like to think it will be helpful for anyone else trying to do what I've done.
Gidgidonihah
 
Posts: 19
Joined: Mon Jul 28, 2008 6:18 pm

Re: Renaming series Fri Oct 31, 2008 4:17 am • by Laner
Gidgidonihah: looking forward to your script.
Laner
 
Posts: 13
Joined: Tue Mar 06, 2007 3:44 am

Re: Renaming series Fri Oct 31, 2008 11:17 am • by Gidgidonihah
Well, I was a little busier than I thought and didn't get it posted on here last night.
Also, I believe I found a problem with it. I have hazel set to recurse folders, but I have the file location hard coded (not good, I know) thinking they'd all be in the same folder. I need to make one change for that, then it should be ready. I'll try again tonight.

And if I don't keep posting here, I forgot, so give me a prod. :)
Gidgidonihah
 
Posts: 19
Joined: Mon Jul 28, 2008 6:18 pm

Re: Renaming series Fri Oct 31, 2008 9:32 pm • by Gidgidonihah
Okay, I got it finished and cleaned up. I posted a new topic in this same section.
Find it here
Gidgidonihah
 
Posts: 19
Joined: Mon Jul 28, 2008 6:18 pm

Previous

Return to Tips & Tricks - DO NOT POST QUESTIONS