Mp3 Book Helper

Filename to Tags

This function is useful if you have files without tags or with some tags but the filenames or directory structure contains information about the artist, title, etc.

To get tags from File names select the files to edit as above. Select Menu 'Tags' -> 'Filename to Tag' or Click button in toolbar.

Filename format describes how file name would be converted to Tags.

Example 1: All information in file names:

The Beatles - The White Album - Disk 2 - 12 Revolution 9.ogg
The Beatles - The White Album - Disk 2 - 13 Good Night.ogg

Filename format in this case:

<Artist> - <Album> - <Ignore> - <Track#> <Title>

Example 2: You have Beatles White Album and files are stored as:

The Beatles\White Album\08 - Revolution 1.ogg
The Beatles\White Album\11 - Cry Baby Cry.ogg

Filename format in this case:

<Artist>\<Album>\<Track#> - <Title>

Filename format consists of tag variables and separators. Variables is subset of Variables used in batch tagging: <Album>, <Artist>, <Title>, <Year>, <Genre>, <Track#>, <Comment>, <Composer>, <Encoder>, <Copyright>, <URL> or short versions dollar style: $B, $A, $T, $Y, $G, $K, $C

Special variable <Ignore> or $Z would ignore text portion of file name between separators.

Filename format works base on separators! Separator could be space or any other character. You could not specify mask like this <Artist><Title> if separator is missing space is assumed. In case if you have file: The Beatles Revolution 1.ogg your best approach would be to use mask: The Beatles <Title> and then apply Artist to tags in batch editing. If you try format <Artist> <Title> with space between tags you will get wrong tags: Artist would be "The" first part of file name before first space and Title would be the rest of the file name string "Beatles Revolution 1".

If the folder name contains some track information you may use the '\' or '<\>' symbols in the file name mask.

Separators could be regular expressions. Separators will not become part of tags.

Filename format has following syntax:

[sep][<Rx>]<Var>[[sep][<Rx>]<Var>]...[sep][||Another_Format].

Where sep separator, <Rx> regular expressions for values, <Var> variable

Last separator is optional, last variable takes everything until the end of string.

If you enable Regular expressions than any variable could be preceded with regular expressions. Parser would match this expression in portion of the file name currently parsed and if it matches value would be used. Otherwise portion of file name between separators would be used.

Enabling Complete Match switch would not apply changes to files with mismatching separators or regular expressions. You could combine more that one format string using or || directive. Mp3BH will try to mach them sequentially.

Use Preview all the time to see how this format will work for your files.

This dialog uses the same approach as "mask builder" in help. You could Drag and Drop variables to the list "Format as list". The list is itemized representation of the format string "Filename format". You could move each variable up or down using Mouse you. The only purpose of Format builder is to help you in typing variables. It can't do more than variables could. Result of Format builder is one string.

On Initial file load if Options 'Batch' Tag Guess Tag Masks to Dropdown is enabled special expression is executed and Dropdown are preloaded with results. This is done base on first file in the list. Default after installation expression is (it is all one line but split here to simplify reading):

<Series> <^\d+><Series#> {<Book>} \(<Author>\)\$<A|U><Abridged>.*<\><Ignore>||
<Book> \(<Author>\)\$<A|U><Abridged>.*<\><Ignore>||
$A - <Series> <^\d+><Series#> - $B - <(abr)|(unabr)><Abridged><\><Ignore>||
<Author> - <Series> <^\d+><Series#> - <Book><\><Ignore>||
<Author> - <Book> - <(abr)|(unabr)><Abridged><\><Ignore>||
<Author> - <Book><\><Ignore>

You could use <Author>, <Book>, <Year>, <Abridged>, <ReadBy> <Series> <Series#> variables.

More about regular expressions:

Example 1: Separator - regular expressions:

The Beatles - The White Album - 12 Revolution 9.ogg
The Beatles _  The White Album _ 13 Good Night.ogg

Second file name has underscore instead of dash and two spaces as separator!

Filename format in this case:

<Artist> [-_\s]+ <Album> [-_\s]+ <Track#> <Title>

Regular expression in this case is: space[-_\s]+space or \s[-_\s]+\s

Example 2: No Separators - use regular expressions:

The Beatles\The White Album\BWA12Revolution 9.ogg
The Beatles\The White Album\BWA13Good Night.ogg

There are no separator between Track# and Title!

Filename format in this case:

<Artist><\><Album><\>BWA<\d+><Track#><Title>

Regular expression in this case is: <\d+> it is regular expressions (any number of digits) for values of <Track#>

'BWA' Would be ignored, considered as separator

Example 3: Use regular expressions to verify format applicability

08 - Revolution 1.ogg
White Album 11 - Cry Baby Cry.ogg

Filename format in this case:

[\d]*<\d+><Track#> - <Title>

If you try: <Track#> - <Title> you will get Track number: White Album 11 for second file and this not what you expect. [^\d]* will ignore anything until first number in the front of file name.

Other Examples:

08 - Revolution 1.ogg
White Album 11 - Cry Baby Cry.ogg

Filename format in this case:

<^\d+><Track#> - <Title>||<\S+\s\S+><Album>\s<\d+><Track#> - <Title>

Invalid expressions are handled this way:

<RegExpr1>RegExpr2<Title> same as RegExpr1RegExpr2<Title>
RegExpr1RegExpr2 is used as separator.
<RegExpr1><RegExpr2><Title> same as RegExpr1<RegExpr2><Title>
RegExpr1 is used as separator.
<RegExpr1>RegExpr2<RegExpr3><Title> same as RegExpr1RegExpr2<RegExpr3><Title>
RegExpr1RegExpr2 is used as separator.

Format syntax: <RegExpr><Ignore><Title> is the same as RegExpr<Title> and this is not the same as <RegExpr><Title>.

Page Top


http://mp3BookHelper.sourceforge.net released under the GNU/GPL license