General use options:
-p "TARGET_FILENAME_PATTERN"
Target file name/basename pattern; is subject to interpolation via "MP3::Tag" method "interpolate()".
Default is "%{mA}%{n0}_%t"; in simplest cases this uses 2-digit track number separated from the title
by underscore. See "interpolate" in MP3::Tag for more details.
Here is the explanation of the default value: due to semantic of escapes "%{mA}" and "%{n0}", if
"TPOS" frame (disk number) is present, it is encoded as a letter, and put before the track number.
If the track number has a form "N1/N2" (meaning track N1 of N2), then N1 is used, and padded by 0s to
the width of N2. If "N2" is not present, padding to width=2 is used.
For example, if "TPOS" is 3/12, and track is "14/173", then what is prepended to the title is
"c014_"; if there is no "TPOS" frame, and track is "4/8", "4_" is prepended without any leading 0.
(If you want to modify the semantic of "%{n0}", note that it is equivalent to
"%{n2:%{n0}}%{!n2:%02n}". So while %02{n0} will ALWAYS 0-pad to at least width=2, the pattern
"%{n2:%{n0}}%{!n2:%03n}" will 0-pad to width=3 in the case N2 is absent.
-e ".ext1|.ext2|..."
"|"-separated list of associated extensions; when renaming source.mp3 to target.mp3, the similar
rename will be done to files with the same basename, and extensions .ext1, .ext2, etc. Defaults to
".inf|.tag|.id3".
-x If not present, the pattern of -p is the basename; the extension of the initial file is appended (as
interpolated by %E). If present, the pattern of -p is the complete file name. Behaviour with non-
empty list of associated extensions is not defined.
The following options have the same meaning as for script "mp3info2"
-D "Dry run": do not rename, just report the calculated renames.
-G Arguments are glob patterns; expand them.
-R Arguments are directory names, recurse inside using option -E for choosing audio files via their
extension.
-r Regular expression to use when looking for audio files per option -R. Defaults to "(?i:\.mp3$)":
will find files ending in .mp3 (ignoring the case). Note that this expression is put into a case-
ignoring regular expression, so if you want it to be case-sensitive, protect it as in
"(?-i:REGEXPR)".
-E "option_letters"
Controls expansion of escape characters. It should contain the letters of the command-line options
where "\\, \n, \t" are interpolated. Default is none.
-@ Replace "@" by "%" in option values. (May be useful since -p and -P may have a lot of embedded
characters "%", which may be hard to deal with on some shells, e.g., DOSISH shells. DOSish shells
recognize double quotes, so if one wants shell-transparent examples of command lines, use -@ and
double quotes.)
-P "patterns"
Patterns to parse before application of the rule -p. See mp3info2 for details.
-C "config_options"
Configuration options for MP3::Tag. See mp3info2 for details.
File name portability options:
-s Make the components of file names short enough to fit on a CD file system. Currently this means the
restriction to 110 chars (as with "mkisofs -J --joliet-long", at least of version 2.01a32). The
limit may be modified per "AUDIO_MAX_FILENAME_LEN" environment variable.
Note that "components" are parts separated by a literal character "/" in the given pattern (not
slashes coming from interpolated strings).
-c Latinize file names (for portability) assuming they are in Unicode (or WinCyrillic) encoding. Needs
transliterate_win1251.pm (in examples/mod/Encode directory of the distribution; put it in the
subdirectory Encode of the script directory).
-K Do not convert "exotic" characters to underscores (those characters which have a low portability
score, so the files will have problem being moved between systems).
-L The value of option "-L" is the encoding used for the output; if the value is a number, system-
specific encoding is guessed (and used for the output if the bit 0x1 is set); if the bit 0x2 is set,
then command line options are assumed to be in the guessed encoding; if the bit 0x4 is set, then
command line arguments are assumed to be in the guessed encoding. If the bit 0x8 is set, the
encoding/decoding configuration of file input/output of "MP3::Tag" is redone with the the detected
encoding.
-U In presence of "-U" option the default for "-L" is 15, and the decoding/encoding processing happens
as if LANG is set for "UTF-8" encoding. (For example, for "-Uee 1" the "STDOUT" the output message
of this script happens in UTF-8 mode, which makes it easier to detect decoding/encoding errors in
tags.)
Note that this utility performes very similarly to mp3info2 utility when the latter one is used with -p
option; only instead of printing the result of interpolation of -p, it uses the result as the target file
name for renaming (after some "sanitizing" of the result). (However, the defaults for "-E" options
differ!)
Please take into account that the option -P is provided for completeness only. If one needs really
complicated parsing rules to deduce the resulting file name, it is much safer to use mp3info2 utility to
set the wanted file name into some ID3v2 frame (such as "TXXX[wanted-target-name]"), and then, after
checking for errors, use this result similarly to
audio_rename -p "%{TXXX[wanted-target-name]}" -R .
After rename, one can delete this frame from the resulting files.
If you want to be absolutely error-prone, preserve the initial file name inside the files by doing
something similar to
mp3info2 -@F "TXXX[orig-fname]=@A" -R .
before the rename. If worst comes to worst (but no race conditions happend, so files are not
overwritten), one should be able to restore the status quo by running
audio_rename -@p "@A" files_or_directories_list
(giving -R option if needed).