Parse the file name

This is my first attempt to use MP3Tag.
I have music files in the form:

Composer Title.mp3 e.g.:
Rachmaninov Piano Concerto No_3 in D minor, Op_30 - 3_ Finale (Alla breve)(1).mp3

The first proper noun is the Composer. The remainder of the file name is the Title .mp3
Is there a way to build tags to extract the Composer and Title from the file name?

Frank C

you can try
Enter as mask:
%composer% %title%

To do this automatically you would need a delimiter that seperates the composer from the title.
In your example this delimiter is a blank.
As a blank may occur in many ways not only as a delimiter between composer and title but also as part of the composer, I can see no way do do this.

Ludwig van Beethoven Symphony No. 5.mp3

As 'poster' has pointed out, there is a problem with the filename, which has no distinct or unique character, which can work as a separator between the composer part and the title part.
But there might be a way to go, when you are able to insert a separator character or string between the two parts.
Having these filenames ...
Ludwig van Beethoven Symphony No. 5.mp3
Rachmaninov Piano Concerto No_3 in D minor, Op_30 - 3_ Finale (Alla breve)(1).mp3
... there is, following the composer's name, the title part, starting with a special word like 'Symphony' or 'Piano'.

It is easy to double the space character before the word 'Piano' and the word 'Symphony'.
Replace ' Piano' with ' Piano'.
Replace ' Symphony' with ' Symphony'.
... or ...
Replace 'Piano' with ' Piano'.
Replace 'Symphony' with ' Symphony'.

Use Convert "Filename - Tag".

Filename: "T:\TEST\Ludwig van Beethoven Symphony No. 5.mp3" Format string: %ARTIST% %TITLE% ARTIST: Ludwig van Beethoven TITLE: Symphony No. 5

Alternatively you can use a 1-step action "Guess values".

Source format: $replace(%_filename%,' Symphony',' Symphony') Guessing pattern: %ARTIST% %TITLE%

... or ...

Source format: $regexp(%_filename%,' (Piano|Symphony) ',' $1 ') Guessing pattern: %ARTIST% %TITLE%

... or ...

Source format: $regexp(%_filename%,' (Piano|Symphony) ',' - $1 ') Guessing pattern: %ARTIST% - %TITLE%

You may use any character or string as the separator, which can ease the splitting.


Just another idea to do it half-automatically.
I think that there are only few composers and a lot more titles.

My suggestion is:

  1. Filter with the composer's name
    e.g. %_filename% HAS Rachmaninov

  2. Mark all the filtered files and fill in the composer's name manually in the tag-panel

Now you have a tag with the composer's name and you only need to extract the title from the filename.
For this define an action
Field: TITLE
Format String: $cutleft(%_filename%,$add($len(%artist%),1))

I am sure there might be a more elegant solution but I think my solution at least spares you some work.

Thanks to all for the suggestions.
I will report back when I have tried them.
In case I have to do lots of renaming,
what would be an appropriate field delimiter between Composer and Title
that MP3tag could use?
Frank C

it is not really something for MP3tag - it is something that has to do with structure: the delimiter gives an amorphous string a structure.
The best thing is usually something that does not appear in ordinary language or writing.
The blank (space) is bad as it delimits every word.
A hyphen is a little better but still appears in a lot of titles.
If you have the choice then I would suggest the underscore _
But probably your files already have a name that do not know that they should be parsed by Mp3tag soon.

Thanks to all,
I got it to work for my classical music folder.
The file names were Composer (blank) Composition Title.
I used the filter "File Name-Tag" and the format %artist% %title%
For Ippolitov_Ivanov I used the underscore.

If I have a folder entirely by one artist is there a way to load this artist as a literal into every properties > artist?

Frank C

Take the Converter Tag->Tag or alternatively define an action Format Value:

Format String: %_directory%

Type: Format Value
Format String: %_directory%

Thanks Poster,
That Worked. But, I don't understand how it did.
I used it on a folder of Al Hirt. Each file is in the form:
Title - Hirt
Danke Schoen-Hirt.mp3
I used:
Format String: %_directory%
as you suggested.
I guess the Name Al Hirt came from the Folder (directory name).
I didn't have Al in each file, only Hirt.
That's Great!
Frank C

You guess right.
The content of the artist-tag was replaced by the folder-name.