fix_tags – manipulate ID3 tags and then some…

I would like to introduce you to a tool that you have probably needed or will need some time. It’s called fix_tags and is written by my friend Mr. Dave Morriss, lead developer at Hacker Public Radio. While the tool claims to only change the tags in MP3 and OGG, it also modifies WAV and FLAC without problems as well.

It’s hosted over on the HPR Gitorious site, but if you just want the tool itself just copy the file from here: fix_tags. I saved it in /usr/local/bin/fix_tags, which makes it available to everyone on the system and then changed permissions so that it could execute.

chmod +x /usr/local/bin/fix_tags

It’s written in perl, and has some dependencies on some perl modules which can be installed easily from cpan. Most distributions install cpan by default but for some reason I needed to install it on Fedora. You will also need to install development tools and Perl Documentation if you haven’t already done so.

Debian:

apt-get install build-essential perl-doc

Fedora:

yum groupinstall "Development Tools" && yum install perl-CPAN perl-Pod-Perldoc

Now that cpan is installed, we need to update it, reload it and then install the perl dependencies. You do this by running the command cpan as root

install CPAN
reload cpan
install Modern::Perl Getopt::Long Pod::Usage Data::Dumper File::stat Date::Manip::Delta Date::Manip::TZ Audio::TagLib
quit

While there is complete help available by typing perldoc fix_tags you can get a good idea of what awaits by typing fix_tags –help

Version 1.2

Usage:
     fix_tags [ -help ] [-album=ALBUMSTRING] [-artist=ARTISTSTRING]
        [-comment=COMMENTSTRING] [-genre=GENRESTRING] [-title=TITLESTRING]
        [-track=TRACKNUMBER] [-year=YEAR] [-[no]fix_comment] audio_file ...

Options:
    -help   Prints a brief help message describing the usage of the program,
            and then exits.

    -album=ALBUMSTRING
            Sets the album tag to the string defined by the option.

    -artist=ARTISTSTRING
            Sets the artist tag to the string defined by the option.

    -comment=COMMENTSTRING
            Sets the comment tag to the string defined by the option.

    -genre=GENRESTRING
            Sets the genre tag to the string defined by the option.

    -title=TITLESTRING
            Sets the title tag to the string defined by the option.

    -track=TRACKNUMBER
            Sets the track tag to the number defined by the option.

    -year=YEAR
            Sets the year tag to the number defined by the option.

    -[no]fix_comment
            If selected, causes the comment tag to be edited to remove
            non-graphic characters, newlines and multiple space sequences.

To use the tool just point it at a file and it will show you all the common fields that are of interest.

$ fix_tags 955-The_Loss-Return_to_Litany.mp3
955-The_Loss-Return_to_Litany.mp3
album     : MIND OUT
artist    : Return to Litany
comment   : http://www.jamendo.com Attribution-Noncommercial-No Derivative Works 3.0
genre     : 
length    : 00:04:09
title     : The Loss
track     : 0
year      : 2012

As an example you could change the genre by using fix_tags -genre=”cchits.net” 955-The_Loss-Return_to_Litany.mp3. Resulting in:

$ fix_tags 955-The_Loss-Return_to_Litany.mp3
955-The_Loss-Return_to_Litany.mp3
album     : MIND OUT
artist    : Return to Litany
comment   : http://www.jamendo.com Attribution-Noncommercial-No Derivative Works 3.0
genre     : cchits.net
length    : 00:04:09
title     : The Loss
track     : 0
year      : 2012

An excellent tool from a most Excellent Gentleman.

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published.