Mp3 Book Helper

Tag Editing Variables

To set ID3 tags and File name you can use special variables to make these tags more useful and easy to set. If input filed in program supports masks you would be able to insert variables to this masks using popup context menu for this filed.

Variable names are matched case sensitively fist, and if not found insensitively. '\' is escape character before variable use <\> or \\ To make single \ before variable.

Predefined variables types:

Variable Class Variables
Tag values $A <Artist> <Author> $B <Book> <Album> $T <Title>
$K <Track#> $k <track#> $G <Genre> $Y <Year> $C <Comment>
<Composer> <Encoder> <Copyright> <URL> <Tag ID3v2FRameName>
$. <Self> <This>
Derived from Tag values $2 ${2B} <2Book> <2Album> ${2A} <2Author> <2Artist> $4 ${4AB} <4AB>
Special fields $R <ReadBy> $S <Series> $s <Series#> $U <Abridged> <AbridgedUA> <AbrUnabr> <Abr>
File and folder names $F <File> <FileExt> $D <Folder> <Directory> $P <Path> <PFolder> <PDirectory> <PPFolder> <PPDirectory>
Counters $I <Count> $i <count> <Count01> $L <Count0> $l <count0>
$N <Total> $0 <XXX>
$J <CountTape> <TapeCount> <TotalTape> <TapeTotal> <XXT>
<CheckedCount> <checkedcount> <CheckedTotal>
$#I <CountF> $#N <TotalF> $#F <FoldersCount>
Mp3 info <EncBr> <EncHz> <EncMode> <EncKHz> <EncVBR> <FileSize> <FileSizeKb> <FileSizeB> <FileSizeMB> <Duration> <DurationMin> <DurationSec> <DurationSecMSec> <DurationHHMM> <DurationHHMMSS>
Other <FileCRC> <Char Number>
Directives <SR#> <SL#>
<CU> <CL> <CC> <CA>
<R><what><with> <r><what><with> <ri><what><with> <IF><what><then><else> <IFE><what><then>
<F><spec> <FD><spec>
<X><what> <XS><skip><what> <XE><what><skip>
<FileItem><number><expression> <FileList><expression>
<FlagFile><dos_mask> <TextFile><file_name>
<T><rus2lat> <T><lat2rus> <T><file_name>
<Rnd><#>
<Expr><expression>

 

Available predefined variables:

$T - Track Name (ID3 Tag)

Synonym: <Title>

$B - Album / Book Name (ID3 Tag)

Synonyms: <Album>, <Book>

$A - Author / Artist (ID3 Tag)

Synonyms: <Artist>, <Author>

$K - Track number (ID3 Tag)

Synonym: <Track#>

$k - Track number (ID3 Tag)($K) Not formatted, Not zero tabbed

Synonym: <track#>

$G - Genre (ID3 Tag)

Synonym: <Genre>

$Y - Year (ID3 Tag)

Synonym: <Year>

$C - Comment (ID3 Tag), COMMENT from Ogg

Synonym: <Comment>

$2 - 2 chars from Album (Book Title)

Synonyms: ${2B}, <2Book>, <2Album>

Example: Title 'Fellowship of the Ring' produce 'FR'

$4 - 4 chars from Author and Title;

Synonyms: ${4AB}, <4AB>

Example: Author, Title 'JRR Tolkien', 'Fellowship of the Ring' produce 'JTFR'

${2A} - 2 chars from Author

Synonyms: <2Author>, <2Artist>

Example: Author 'JRR Tolkien' produce 'JT'

$. - Original value of tag or name you are modifying

Synonym: <Self>, <This>

Page Top

$R - Read By Not ID3 tag, this is just variable you enter manually,

Defaults for it extracted from comments in tags that contains anything

resembling read by, narrator and variations and

read from existing NFO files

Synonym: <ReadBy>

$S - Series Name Not ID3 tag, this is just variable you enter manually.

Synonym: <Series>

$s - Series Position Not ID3 tag, this is just variable you enter manually.

Synonym: <Series#>

$U - Abridged, This value you enter manually,

default for it extracted from NFO

Synonym: <Abridged>

<AbridgedUA>, <AbrUnabr>, <Abr> - Constructed base on <Abridged>

Page Top

$I - Track counter (formatted enumeration of loaded files starts from 1)

Files are numbered by the order they appear is the file list.

If you have less then 10 files ($N) it would create numbers 1, 2, 3. See <Count01>

If you have 10 to 99 files it would create numbers 01, 02, 03 .

If you have 100 to 999 files it would create numbers 001, 002, 003 .

Synonym: <Count>

$i - Track counter (starts from 1), $I not zero tabbed

Synonym: <count>

$N - Number of files total (counts only loaded to program files)

Synonym: <Total>

$L - Track counter (starts from 0)

Synonym: <Count0>

$l - Track counter (starts from 0), $L not zero tabbed

Synonym: <count0>

$0 - Fill the same size as counter using 0 or see options

Synonym: <XXX>

$J - Tape Files counter (starts from 1A or 01A then 1B, 2A.)

Synonym: <CountTape> <TapeCount>

<TotalTape> - Number of Tapes (total of files divided by 2)

Synonym: <TapeTotal>

<XXT> - Fill the same size as <TapeCount> using 0 or see options

<CheckedCount> - Checked Files counter (starts from 1)

<checkedcount> - Checked Files counter (starts from 1), not zero tabbed

<CheckedTotal> - Total Number of Checked files

Page Top

$F - File Name

Synonym: <File>

<FileExt> - File Name extension .mp3 or .ogg

$D - Folder Name

Synonyms: <Folder>, <Directory>

Also <PFolder>, <PDirectory>, <PPFolder> and <PPDirectory> Could be used for Parent Folder Name and Parent of Parent folders names

$P - Full Folder Path

Synonym: <Path>

Page Top

$#I - Files counter in folder (only loaded to program)

Synonym: <CountF>

$#i - Files counter in folder, $#I not zero tabbed

Synonym: <countf>

$#L - Files counter in folder (starts from 0)

Synonym: <CountF0>

$#l - Files counter in folder (starts from 0), $#L not zero tabbed

Synonym: <countf0>

$#N - Total number of files in folder

Synonym: <TotalF>

$#0 - Fill the same size as <CounterF> using 0 or see $0

Synonym: <XXF>

$#F - Folder number (enumeration of folders starts from 1)

Synonym: <FoldersCount>

$#f - Folder number, not zero tabbed

Synonym: <folderscount>

$#T - Total number of opened folders

Synonym: <FoldersTotal>

Page Top

<Composer> - Composer from ID3v2, Performer from Ogg

<Encoder> - Encoder from ID3v2 and Ogg

<Copyright> - Copyright from ID3v2 and Ogg

<URL> - Link from ID3v2 , Location from Ogg

<Tag ID3v2FRameName> - Get ID3v2 text frame: TIT1, TBPM and so on..

Example: <Tag TIT1>; Will get content group <Tag TALB>; Will get album for Vorbis or ID3 tags

<Tag VobisTagName> - Get Vorbis text frame

Example: <Tag ALBUM>; Will get album for Vorbis tags

<FileCRC> - Name of first SFV or PAR that contains the file

<Char Number> - Get special ASCII character Tab, CR and so on..

Number could be in decimal or hex format

Example: <Char 9> will create TAB character

<Char 0xa9> will create © symbol

Advance variable useful for NFO generation:

<EncBr> <EncHz> <EncMode> <EncKHz> <EncVBR>

<FileSize> <FileSizeKb> <FileSizeB> <FileSizeMB>

<Duration> <DurationMin> <DurationSec> <DurationHHMM> <DurationHHMMSS>

<FD><mm' Min' ss' Sec'><DurationSec>

<FD><c' milliseconds'><DurationSecMSec>

There are 57 predefined variables now, if you want more you are able to define your own custom variables in "Mask help" window.

In "Mask help" window there are "Mask builder" tab is to help you in typing variables. In mask builder you could Drag and Drop variables to the list "Mask as list". The list is itemized representation of the mask string "Mask as text". You could move each variable up or down using Mouse you. Result of mask builder is one string (mask). When you created this string you could add it to preset and use in future.

Page Top

String Format and Extract directives.

Use these directives before a variable to affect only that variable and then characters between variable and the directive, or as the last directive to affect the complete result. Grouping variables using [[ ]] brackets is allowed. Nesting groups can only be done using Custom variables.

<SR#> or <SL#> - String Format Left or Right justified, where # is width of the resulting string for next Variable.

Example: <SR40>(<Album>) or <SL30><Album>

<CU> <CL> <CC> <CA> - Case change and capitalize directives

<CU> - UPPER CASE

<CL> - lower case

<CC> - Capitalize first word

<CA> - Capitalize All Words

<UM> - Un-merge directive,

Insert spaces before Capital letter only after Lower Case or -,_;'`~"

Example: WwwTorontoON.CA<UM> -> Www Toronto ON.CA

Page Top

<R><what><with> - Replace directives, support Regular Expressions

"what" could be Regular Expression.

"with" could contain other variables.

References to matching expression could be made using RegEx backreferences \0 \1 ... \9 or $& $1 . $9 for substitution. $0, $2, $4 are Mp3BH variables so escape should be used (use \$0 $1 \$2 ... $8 $9). \0 \1 through \9 are translated to $0, $1... $9 before execution so you could use any of this for substitutions.

<r><what><with> - Replace directives, No regular Expressions,

<ri><what><with> - Replace directives, Ignore case, No regexp,

Example: <File><R>< ><_> would replace all spaces with underscore.

<R><^.{4}><>$F would remove first 4 characters from file name

<R><^The (.*)><\1, The>$F would match 'The Any thing' and returns 'Any thing, The'.

<R><^(\w+)\s*(\w+)><\2 \1>$A Should reverse the first and last name.

How Do I replace the second underscore by a space?

$F<r><_>< ><R><^([^ ]*) ><\1_> or 

$F<r><_>< ><R><^(.*?) ><\1_> would take '01_Any_thing' and returns '01_Any thing'.

Page Top

<IF><what><then><else> - Returns "then" when "what" results in not empty

string. If No variables set in "what" or result is empty string returns "else".

"What", "then", "else" could be any variables expression.

For nested if you will need to define custom variables

Example: <IF><$S><$A><$B>

If $S = MySeries then it gives Author

If $S Empty then it gives Album

<IFE><what><then> - Returns "what",

If No variables set in "what" or result is empty string returns "then"

Example: $A<IFE>< - $S - >< - >$B

If $S = MySeriesthen it gives Author - MySeries - Album

If $S Empty then it gives Author - Album

Example2: <IFE><<X><FindMe>$S><NotFound>

If $S = FindMe then it gives: FindMe

If $S = FindHim then it gives: NotFound

Page Top

<F><spec> - Format directive, [%][-][width][.prec]type

Example: <F><.2d><Count> -> 01

Format specifiers have the following form:

[%][-][width][.prec]type

A format specifier begins with a % character. After the % come the following, in this order:

An optional left justification indicator, ["-"]

An optional width specifier, [width]

An optional precision specifier, ["." prec]

The conversion type character, type: d, u, x, f, g, n or s

The following table summarizes the possible values for type:

bDecimal. The argument must be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros.

uUnsigned decimal. Similar to 'd' but no sign is output.

xHexadecimal. The argument must be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.

sString. The argument must be a character, a string value. The string or character is inserted in place of the format specifier. The precision specifier, if present in the format string, specifies the maximum length of the resulting string. If the argument is a string that is longer than this maximum, the string is truncated.

fFixed. The argument must be a floating-point value. The value is converted to a string of the form "-ddd.ddd...". The resulting string starts with a minus sign if the number is negative.The number of digits after the decimal point is given by the precision specifier in the format string-a default of 2 decimal digits is assumed if no precision specifier is present.

gGeneral. The argument must be a floating-point value. The value is converted to the shortest possible decimal string using fixed or scientific format. The number of significant digits in the resulting string is given by the precision specifier in the format string-a default precision of 15 is assumed if no precision specifier is present. Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary. The resulting string uses fixed point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001. Otherwise the resulting string uses scientific format.

nNumber. The argument must be a floating-point value. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The "n" format corresponds to the "f" format, except that the resulting string contains thousand separators.

Page Top

<FD><spec> - Format Duration directive, hh.mm.ss.cc

Example: DurationSec=265; <FD><mm' min' ss 'sec' ><DurationSec> -> 04 min 25 sec

To include literal strings in the format, enclose them in single quotes. Failing to quote literal strings can have unpredictable results, even if they do not include formatting codes. Use two single quotes to represent one single quote character in literal string.

Page Top

<X><what> Extract directive, what: Regular Expressions

<XS><skip><what> Extract and skip from start directive

<XE><what><skip> Extract and skip from end directive

Extractions example:

File name: Artist Name - Album Name - 01of20.mp3

Mask Result
<X><[\w\s]*>$F
Artist Name
<XS><[\w\s]*>< [\w\s]*>$F
Album Name
<XE><[\w\s]*><.{8}>$F
Album Name
<XE><[\w\s]*><-\s\d.*>$F
Album Name

More Examples

<XLastName> and <XFirstName> name Extraction directives

Patrick O'Brian -> <XFirstName> = Patrick

<XLastName> = O'Brian
  O'Brian, Patrick -> <XFirstName> = Patrick
<XLastName> = O'Brian
  Richard North Patterson -> <XFirstName> = Richard North
 <XLastName> = Patterson
  D. Preston and L. Childs -> <XFirstName> = D.
                              <XLastName> = Preston
  D. Preston & L. Childs   -> <XFirstName> = D.
                              <XLastName> = Preston

Page Top

<FileItem><number><expression> Reference to another file

<FileList><expression> Create mp3 files list may be used in NFO creation

<FlagFile><dos_mask> Find first file in current directory

Example: <FlagFile><*.sfv> or <FlagFile><*.sfv|*.par>

<TextFile><file_name> Context of the text file specified by name

<T><rus2lat>, <T><lat2rus> Transliteration Cyrillic to Latin

Performs transliteration of ANSI Cyrillic (Windows 1251) text with readable Latin combinations, known as 'Runglish' or 'Volapyuk', and also can perform reverse translation from 'Runglish' text to its Cyrillic equivalent.

<T><#1, #2> Transformation CodePage#1 to CodePage#2,

Example: <T><20866, 1251> KOI8-R -> Cyrillic Windows

<T><file_name> Transformation using configuration file

See example file: transl_rus2lat.txt in Mp3BH installation directory

If no path specified in file name <T> directive will search in mp3BH installation directory first, then current directory.

Page Top

<Rnd><Number> - Random number generation from 1 to Number

<RndU><Number> - Unique random number generation from 1 to Number, each number would be generated once

Number could be expression

Example: <Rnd><9> will create random number from 1 to 9

     <F><.3d><Rnd><<Total>> will create random number from 001 to number or files in list


<Expr><Expression> - Evaluate the value of mathematical expression

Example: <Expr><2+2> will make 4
     <Expr><<Count>+10> will start enumeration from 11

Page Top

Custom variables

You could create your own 'custom' variables as combination of predefined variables using Variables Help window. Custom variables name should be included in angle brackets <> and should have name distinct from predefined variables. These Variables are preserved in Mp3BookHelper.ini file.

After installation there are predefined 'custom' variables:

Variable Mask used to build it Description
<Rs4F> <R><^.{4}><>$F Removes first 4 chars from file name
<Rl4F> <R><.{4}\Z><>$F Removes last 4 chars from file name
<ExtStart1F> <X><[^-]*>$F Extract words from start of file name until first -
<ExtStart2F> <XS><[^-]*-><[^-]*><File> Extract 2nd part of file name between -
<ExtStart3F> <XS><[^-]*-[^-]*-><[^-]*>$F Extract 3rd part of file name
<ExtLastF> <X><[^-]*\Z><File> Extract part of file name after last -
<Count01> <F><.2d><Count> Format <Count> left-padded with zero
it would create numbers 01, 02, 03
<CountF01> <F><.2d><CountF> Format <CountF> left-padded with zero
<001> <F><.3d> Format Value left-padded with zero
<IfSeries> <IFE><$S $s - ><> Series if Any of $S or $s are set
<IfReadBy> <IFE><Read by $R><> Read by if $R set
<Tab> <Char 9> Create Tab character

 

Page Top


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