Help creating a matching pattern

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

Moderator: Mr_Noodle

Help creating a matching pattern Fri Sep 27, 2019 12:05 am • by Minel
Hello all,
This is probably a simple fix but I seem to be stuck

I download some videos which come with odd names and I'd like to use hazel to rename them into proper episode names

Example:

Chefi la cutite sezonul 7 episodul 9 online.mp4
Chefi la cutite sezonul 7 episodul 10 online.mp4

I am basically doing this really nooby and I apologize but I'm not sure how to do it

Currently I have individual rules if name contains episodul 9 then rename to Chefi.la.cutite.s07e09.mp4 and a new rule with 10 and so on

Is there a way I can set it up to grab the number after the seazon and after the episode so I have to make only 1 rule?

Also if the season / episode is a single digit to put a leading 0

Thanks!
Minel
 
Posts: 3
Joined: Thu Sep 26, 2019 11:54 pm

Re: Help creating a matching pattern Fri Sep 27, 2019 10:21 am • by Mr_Noodle
When creating a pattern, identify the parts that are fixed. In your case, I guess it's the words "sezonul" and "episodul". Enter those into the pattern as is.

It looks like everything before "sezonul" is the show name so create a custom attribute there and have it match "anything".

For the numbers, create a custom attribute to match a number in each case.

Now that you have the custom attributes, you can recombine them as needed in the rename action. You can use the "Replace text" option to replace spaces with dots. And for the number custom attributes, you can format them to have a minimum of two digits so that it will use a leading 0 as necessary.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help creating a matching pattern Sun Sep 29, 2019 11:42 am • by Minel
Thanks for your help Mr. Noodle.
I'll try to figure it out
Minel
 
Posts: 3
Joined: Thu Sep 26, 2019 11:54 pm

Re: Help creating a matching pattern Sun Sep 29, 2019 12:25 pm • by Minel
Unrelated but is there a way that I can make Hazel rename a file to only the first xx characters and remove anything afterwards?

so I would like only the first 16 characters, then remove the rest


Thanks!
Minel
 
Posts: 3
Joined: Thu Sep 26, 2019 11:54 pm

Re: Help creating a matching pattern Mon Sep 30, 2019 8:18 am • by Dave61
Minel wrote:Unrelated but is there a way that I can make Hazel rename a file to only the first xx characters and remove anything afterwards?

so I would like only the first 16 characters, then remove the rest


Thanks!

The match string would be [CustomToken][Anything] where the custom token is [a1%] (the token for a letter, digit, or other character) 16 times.

The action would be Rename [CustomToken][Extension].
Dave61
 
Posts: 113
Joined: Tue Jul 10, 2012 4:56 pm


Return to Support