help! grab year from filename? (tricky!)


#1

Hi,

I'm not able to figure out how to create a regular expression for the following mp3 filename format, so that I can create tags from the filename. Here is the format:

Herbie Hancock 1972 - Sextant - 01 Rain Dance.mp3
artist year - album - tracknumber title

Specifically I am having problem with the year, when the artist has more than one name (first name and last name). It usually gives me

Artist: Herbie
Year: Hancock 1972
Album: Sextant
etc.

Does anyone have any ideas on how to parse a filename like that? (My knowledge of regex is not good, so it may be easy for somebody who knows their regex)

Thanks


#2

I think you do not need a regular expression featured action.
You may get what you want only by invoking the ready built in converter action 'filename - tag' using the appropriately format string.

DD.20070225.2338

Edit:

Well, my proposal above was a quick shot, only matching those strings that have the identical structure like your sample string.
So you might want to do an action using regular expressions?

Here comes an action group set, that might do what you want.

Action #1:
Action type: Format value
Field: VMUELLER_ARTIST
Formatstring: %_FILENAME%

Action #2:
Action type: Format value
Field: VMUELLER_YEAR
Formatstring: %_FILENAME%

Action #3:
Action type: Format value
Field: VMUELLER_ALBUM
Formatstring: %_FILENAME%

Action #4:
Action type: Format value
Field: VMUELLER_TRACK
Formatstring: %_FILENAME%

Action #5:
Action type: Format value
Field: VMUELLER_TITLE
Formatstring: %_FILENAME%

Action #6:
Action type: Replace with regular expression
Field: VMUELLER_ARTIST
Regular expression: ^(.+?) (\d+) - (.+?) - (.+?) (.+?)$
Replace matches with: $1

[ ] case-sensitive comparison

Action #7:
Action type: Replace with regular expression
Field: VMUELLER_YEAR
Regular expression: ^(.+?) (\d+) - (.+?) - (.+?) (.+?)$
Replace matches with: $2

[ ] case-sensitive comparison

Action #8:
Action type: Replace with regular expression
Field: VMUELLER_ALBUM
Regular expression: ^(.+?) (\d+) - (.+?) - (.+?) (.+?)$
Replace matches with: $3

[ ] case-sensitive comparison

Action #9:
Action type: Replace with regular expression
Field: VMUELLER_TRACK
Regular expression: ^(.+?) (\d+) - (.+?) - (.+?) (.+?)$
Replace matches with: $4

[ ] case-sensitive comparison

Action #10:
Action type: Replace with regular expression
Field: VMUELLER_TITLE
Regular expression: ^(.+?) (\d+) - (.+?) - (.+?) (.+?)$
Replace matches with: $5

[ ] case-sensitive comparison

This emits following tags:

DD.20070225.2357




#3

DetlevD,

Thanks for the in-depth reply. So I made an action group, exactly like you outlined. However, when I selected a file and ran the action, none of the tags showed up in their fields. Am I doing something wrong?

Thanks,
Vergil


#4

Well, there are always occasions to do something wrong, and as always there is no chance to see from over here what might going wrong on your side.
My example works with custom tags.
You may use Extended Tag View [Alt-T] or set up new columns for the custom tags in the grid file list.
Keep in mind that you have to adapt the field names from my example to your own needs.

DD.20070227.0220