NAME

smartid3.pl - script for organizing mp3 files


SYNOPSIS

    smartid3.pl
       [ -hirDSRwcIFW_s ][u|l|t]
       [ -A  <artist> ] 
       [ -T  <album Title> ]
       [ -N  <track number> ]
       [ -O  <song title> ]
       [ -V  <level> ]
       [ -v  <level> ]
       [ -p  <separator> ]
       [ -f  <Format string> ]
       [ -L  <log file> ]
       [ -B  <log file> ]
       [ -z  <lower logindex> ]
       [ -Z  <upper logindex> ]
       dir


DESCRIPTION

smartid3.pl aims at organizing mp3 files automatically for you. The idea is that you should be able to run the script on a large amount of files to get them organized in a consistent manner according to your desires.

It works by giving the filename of the mp3 to a number of methods which each has it's own special way of guessing the song, album, artist title and track number. Each method has a vote_value which is a notation on how reliable the method is.

Before all methods vote, there is a preprocessing phase done on the files, which looks at all the files given and tries to figure out possible albums and artists. The idea is that albums and artists, shows up in several filenames.

After all methods have voted there are some postprocessing done on the votes such as checking for strange values such as for instance 'http' in either entry, which would lead to a reduction of that entrys score, the entries are also checked to see it the artist is the same as the album and so on.


OPTIONS

-h

Prints a short helptext.

-i

Makes the script take the filenames as command line arguments rather than working on a directory.

-r

Recursive down in subdirectories.

-D

Debug mode, will not modify any files, just print some info.

-S

Misc usable functionallity. =)

-w

Makes the script write id3 tags to files which have no id3 tags.

-c

Makes the script create subdirectories for artist and album.

-A <artist>

Give the artist name on the command line. Can be used with -w to write id3 tags to files which have none.

-T <album>

Give the album name on the command line. Can be used with -w to write id3 tags to files which have none.

-O <song title>

Give the song title on the command line. Can be used with -w to write id3 tags to files which have none.

-N <track number>

Give the track number on the command line. Can be used with -w to write id3 tags to files which have none.

-I

Ignore the id3 tag, good if the tag is set to strange things.

Use ONLY id3 tag.

-R

Remove the ID3 tag. (This is done first, so if -W is also invoked the file will still have a ID3 tag after the operation)

-L ``<logfile>''

use logfile

-B ``<logfile>''

revert files from logfile

-z ``<logindex>''

the lower bound for the logindex (used with -B)

-Z ``<logindex>''

the upper bound for the logindex (used with -B)

-F

Force writing of the file even if it exists, good to use if for instance you want to change the id3 tag. USE WITH CAUTION

-W

Force writing of the id3 tag even if it exists. USE WITH CAUTION

-V <level>

Verbosity, this option specifies a specific verbosity level, so only messages whith that level set will be printed.

-v <level>

Verbosity, this option specifies a minimum verbosity level, so messages whith 'level' and above will be printed.

-p <separator>

Separator, inserted between artist, album, track and songname.

-f <format string>

Output format

%f = filename
Filename.

%a Artist
Artist name.

%s Song
Song title

%t Album Title
Album Title

%n Track number
Track number

-_

Change spaces to underscores

-s

Change underscores to spaces

-u

Uppercase name

-l

Lowercase name

-t

Title case name

-g <format>

The -g option takes the format of the files on the command line, if for instance you know that all the files are on the format Artist-Album-Track-Title.mp3 this option let's you tell that to the script


EXAMPLES

To see the ID3 tags and the heuristic guesses on the mp3 files in the directory execute the following:

     perl smartid3.pl -D

To write id3 tags to files which have none and create subdirectories for artist and album exectute this:

     perl smartid3.pl -w -c

To use ' - ' as a separator and put the songs in subdirectories according to artist and album, and format the songname as Tracknumber - Songname.mp3 and title case the songname (so for instance 'Michael Jackson-10-are you my life.mp3' with the ID3 tag 'Album' set to Invincible would become './Michael Jackson/Invincible/10 - Are You My Life.mp3') execute the following:

     perl smartid3.pl -f "%n%s" -p " - " -t -c

To remove the ID3 tag in some files do:

     perl smartid3.pl -R

To work only on the files beginning with 'michael_jackson' execute the line below (this option will assumes it will only be given .mp3 filenames)

     perl smartid3.pl -i michael_jackson-*

To force rewriting of the ID3 tag and set the artist to 'Bob Dylan' execute the command below (the -F is to force writing of the file since this is not done per default if the file already exists). (OBSERVE the old entries in the ID3 tag will be overwritten whith the most probable values)

     perl smartid3.pl -W -A "Bob Dylan" -F

To rename the file '01 - Dylan Ashville Nc 50101.mp3' to 'where teardrops fall' and force the rewriting of the ID3 tag with songname 'where teardrops fall' and artist 'Bob Dylan' execute the following:

     perl smartid3.pl -W -f "%n %s" -O "where teardrops fall" -A "Bob Dylan" -F -i "01 - Dylan  Ashville Nc  50101.mp3"

To log all file operations to the logfile /tmp/mylog.log see the following example:

     perl smartid3.pl -L /tmp/mylog.log -f "%s%n" -t -p " - "

To revert the file operations with logindex from 430 and up do:

     perl smartid3.pl -B /tmp/mylog.log -z 430

To revert the file operations with logindex index 0 to 430 do:

     perl smartid3.pl -B /tmp/mylog.log -Z 430

To revert the file operations with logindex between 400 and 430 do:

     perl smartid3.pl -B /tmp/mylog.log -z 400 -Z 430

The following line, logs operations to the file '/tmp/usenet2.log' (-L) and uppercases the first letter in the filename parts (-t) renames the songs to format 'Artist - Tracknumber - Songname.mp3' (-f). It also writes the id3 tag in files which have none (-w).

     perl smartid3.pl -L /tmp/usenet2.log -t -f "%a%n%s" -p " - " -w

The next line revers the operations made by the above line:

     perl smartid3.pl -B /tmp/usenet2.log


ENVIRONMENT

smartid3.pl doesn't use any environment variables.


PREREQUISITES

    Perl.


OSNAMES

    linux 2.4.9 i686-linux


SEE ALSO

mp3frip (MP3 File Renamer in Perl) by Ryan Lathouwers (ryanlath\@pacbell.net)


BUGS

Not thoroughly tested.

Revert has some problems, I ran the program on 380 files and the tried revert, and four files was not succsessfully reverted.

Empty directories is not removed when reverting. [fixed]


AUTHOR

Leif Jonsson <lejon@ju-jutsu.com>


HOMEPAGE

http://www.ju-jutsu.com/smartid3/


DOWNLOAD

http://www.ju-jutsu.com/smartid3/smartid3.pl


COPYRIGHT

License: (to quote Mr Ryan Lathouwers =) This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself (like I've ever read 'em).


SCRIPT CATEGORIES

Audio