tagit.pl


command line options format string format options examples

tagit.pl is another demo program of MP3::Tag. It runs at the console and can change ID3v1/ID3v1.1 tags as well as the filename.

Therefor a lot of command line switches exist. It can set the filename of a mp3 file, according to the information found in a ID3v1 tag. For this a format string says how the filename has to be formed.

With this it is for example possible to set a filename to 'artist - song.mp3' (format string: '%a - %s.mp3'), or even to put the files in directorys like 'artist/album/track. song.mp3' (format string: './%a/%l/%t. %s.mp3')

And if you want that the track number always consists of two digits, do a %2:0t instead of the %t. Directorys, which do not exist yet, can be created on the fly.

try tagit.pl --help to get a list of all command line options.

Command line options:

--album Set the album
--artist Set the artist
--comment Set the comment
--format Set the format for the filename
--genre Set the genre
--help Show all command line options
--nospaces Replace spaces through an underscore in filename
--removetag Remove ID3v1/ID3v1.1 tag from file
--setfilename Set filename accoding to tag information and format
--show Show existing ID3v1/ID3v1.1 tag
--showgenres Show all possible genres
--skipwithoutv1 Skip file if no ID3v1/ID3v1.1 tag is found
--song Set the name of the song
--test Do not change the file, only print which changes would be made
--track Set the track number
--year Set the year
-f Force
-q Be quiet
-v Be verbose
All options may be abbreviated if the abbreviation is non-ambiguous, like --skip instead of --skipwithoutv1.

Format string:

%a replaced with artist
%s replaced with song
%l replaced with album
%t replaced with track
%y replaced with year
%g replaced with genre
%c replaced with comment


Options for %x: (where x is one of the above a, s, l, t, y, g or c):
%nx use only first n characters
artist="artist name" %4a = "arti"
%n:cx use at least n characters, if %x is shorter, fill it with character c
track=3 %2:0t = '03'
artist="abc" %5:_a = "__abc"
%n!:cx same as %n:cx, but if %x is longer than n, cut it at n
artist="abc" %5:_a = "__abc"
artist="abcdefg" %5:_a = "abcde"

Examples:
To see the genres of your mp3-collection, try this:
tagit.pl --test --setfilename --format=" => %g" *.mp3

Set all filenames in the same manner for all files containing ID3v1 tags, thereby replacing spaces with underscores. Put songs of the same artists in an extra directory, and again the songs of one album in an extra subdirectory, naming the songs with tracknumber and song-title.
tagit.pl --format="./%a/%l/%2:0t. %s.mp3" --skip --no --set *.mp3