
supertag - organize your music collection like a real superhero

supertag MODE [OPTIONS] file1.mp3 file2.flac file3.mp3 ...

Extract metadata from audio files to a tabular format:
$ supertag -g *.mp3 *.flac
Get id3v1 and id3v2 tags back in sync, then rename files using tags:
$ supertag -g *.mp3 | supertag -s -p '%02T._%A_-_%a_-_%t'
Set missing tags in bulk; rename files using new tags:
$ supertag -g -A Pinkerton -y 1996 -G Rock *.flac | supertag -s
Extract and set missing tag data from filenames, using a pattern:
$ supertag -g -S -N -P '%a_-_%t' *.mp3 | supertag -s
Rename incoming files and import them into your music library:
$ supertag -g * | supertag -s --library ~/Music
Preview the effects of supertag's default renaming operations:
$ supertag -g * | supertag -n -s -S -N
Build a song database from your entire music collection:
$ sqlite songs.db <<EOF
> create table song(
> path varchar(256) primary key,
> album varchar(128),
> artist varchar(128),
> track varchar(128),
> title varchar(128));
> EOF
$ find . -name \*.mp3 -o -name \*.flac | \
supertag -g -H PATH,A,a,T,t | sed -e 1d > songs.txt
$ sqlite songs.db ".import 'songs.txt' song"

-g,--get get metadata -s,--set set metadata -h,--help print help and exit -V,--VERSION print version and exit
-1,--id3v1 extract from id3v1 tags (default, mp3 only) -2,--id3v2 extract from id3v2 tags (default, mp3 only) -F,--flac extract from flac tags (default, flac only) -N,--filename extract from filenames (default) -U,--audio extract standard audio metadata -E,--codec extract encoder metadata -S,--no-default-sources don't use the default sources -p,--rename-pattern STR format string for renaming files -P,--capture-pattern STR format string for scraping filenames
-A,--album STR -a,--artist STR -t,--title STR -T,--tracknum NUM -y,--year STR -g,--genre STR -c,--composer STR -C,--comment STR
-H,--headers X,Y,Z... output headed tabular data (with -g) -m,--mime get filetype from file(1) (slow, default off) -n,--dry dry run (don't modify anything) -v,--verbose verbose -d,--debug turn on debugging messages -q,--quit silence warnings

supertag is a music organization tool for ordinary people who don't mind dashing into a phone booth once in a while. By "phone booth" we mean "terminal session," the celebrated origin of all superpowers...
There are plenty of music organization tools out there, pretty much one for every occasion. supertag makes sense when:

There are two primary operating modes of supertag: get mode and set mode. In get mode, metadata is extracted from a succession of sources in each file and printed to standard out. In set mode, tabular metadata is read from standard input and written to all selected sources of each referenced file.
The tabular format used and expected by supertag consists of metadata fields separated by the pipe character ('|'), with records separated by newlines. Normally, each field contains a metadata name and key separated by '=', where both key and value have had non-printable and conflicting characters escaped after a URL-encoding ("\n" = "%0a">) fashion. The --headers option accepts a comma-separated list of headers, and causes a line of metadata keys to appear first, followed by records consisting only of metadata values. This headered format is probably more useful for database imports.
By default, supertag operates on a standard set of metadata sources. Some sources are filetype-specific ("id3v2" only applies to .mp3s) and some are standard ("filename" is always available). supertag will never apply filetype-specific sources to files of the wrong filetype. Two special sources, "audio" and "codec" always give standard digital audio metadata ("SAMPLERATE", "NUMCHANNELS", "SECS", etc.) and encoding-specific metadata (e.g. "MP3_LAYER", "MP3_VBR", etc.), respectively.
In get mode, the special metadata key "PATH" is always added with the full, real path to the file being processed as the value. This metadata key must be present for every input record under set mode.
For performance reasons, filetype is by default determined by looking at file extension. Content-based filetype detection via file(1) can be enabled with the --mime flag.
Different audio filetypes are handled through a plugin architecture. This presents a uniform interface to supertag. Developers interested in adding support for new filetypes should subclass all methods in Audio::SuperTag::Plugin via a package called e.g. Audio::SuperTag::Plugin::MYFORMAT.


Alan Grow <agrow+nospam@thegotonerd.com>

Copyright (C) 2008 by Alan Grow
This application is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.