aranger.pl - script for organizing mp3 files
aranger.pl [ -hiormDSRwcIFW_s ] [ -A <artist> ] [ -E <file_regexp> ] [ -T <album Title> ] [ -N <track number> ] [ -O <song title> ] [ -V <level> ] [ -v <level> ] [ -p <separator> ] [ -P <path> ] [ -f <Format string> ] [ -L <log file> ] [ -B <log file> ] [ -z <lower logindex> ] [ -Z <upper logindex> ] [ -M <new topdir> ] [ -I <files> ]
aranger.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.
Give the artist name on the command line. Can be used with -w to write id3 tags to files which have none.
revert files from logfile
Makes the script create subdirectories for artist and album.
Debug mode, will not modify any files, just do the processing and then print some info.
regexp for fileselection \\.mp3$ for .mp3 files for instace
Force writing of the file even if it exists. USE WITH CAUTION
Prints a short helptext.
Makes the script take the filenames as command line arguments rather than working on a directory.
Ignore the id3 tag, good if the tag is set to strange things.
use 'path' as topdir for created filestructure
Give the track number on the command line. Can be used with -w to write id3 tags to files which have none.
Use ONLY id3 tag to deduce fileinfo.
Give the song title on the command line. Can be used with -w to write id3 tags to files which have none.
Separator, inserted between artist, album, track and songname.
Path to files (default directory for files)
Recurse down in subdirectories.
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)
display ID3 and MPG stream info for files in 'dir' (does NO writing to disk)
Give the album name on the command line. Can be used with -w to write id3 tags to files which have none.
-U creates a script ~/smartundo.sh, which is just doing, what it sounds like.
Verbosity, this option specifies a minimum verbosity level, so messages whith 'level' and above will be printed.
Verbosity, this option specifies a specific verbosity level, so only messages whith that level set will be printed.
Makes the script write id3 tags to files which have no id3 tags.
Force writing of the id3 tag even if it exists. USE WITH CAUTION
the lower bound for the logindex (used with -B)
the upper bound for the logindex (used with -B)
Change spaces to underscores (not implemented)
Change underscores to spaces (not implemented)
Uppercase name (this is default right now and can not be changed)
Lowercase name (not implemented)
Title case name (this is default right now and can not be changed)
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
perl aranger.pl -E \\.mp3$ -P ~/data/sound/mp3
perl aranger.pl -f "%t - %a - %n - %s" -E \\.mp3$ -P ~/data/sound/mp3
To see the ID3 tags and the heuristic guesses on the mp3 files in the directory execute the following:
perl aranger.pl -S 'dir'
To write id3 tags to files which have none and create subdirectories for artist and album exectute this:
perl aranger.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 aranger.pl -f "%n%s" -p " - " -t -c
To remove the ID3 tag in some files do:
perl aranger.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 aranger.pl -i michael_jackson-*
To force rewriting of the ID3 tag and set the artist to 'Bob Dylan' execute the command below (OBSERVE the old entries in the ID3 tag will be overwritten whith the most probable values)
perl aranger.pl -W -A "Bob Dylan"
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 aranger.pl -W -f "%n %s" -O "where teardrops fall" -A "Bob Dylan" -i "01 - Dylan Ashville Nc 50101.mp3"
To log all file operations to the logfile /tmp/mylog.log see the following example:
perl aranger.pl -L /tmp/mylog.log -f "%s%n" -t -p " - "
To revert the file operations with logindex from 430 and up do:
perl aranger.pl -B /tmp/mylog.log -z 430
To revert the file operations with logindex index 0 to 430 do:
perl aranger.pl -B /tmp/mylog.log -Z 430
To revert the file operations with logindex between 400 and 430 do:
perl aranger.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 aranger.pl -L /tmp/usenet2.log -t -f "%a%n%s" -p " - " -w
The next line revers the operations made by the above line:
perl aranger.pl -B /tmp/usenet2.log
Unconditionally replaces & with 'and' and Tiles File Names.
aranger.pl doesn't use any environment variables.
smartid3.pl - script for organizing mp3 files by Leif Jonsson (lejon at ju dash jutsu dot com)
mp3frip (MP3 File Renamer in Perl) by Ryan Lathouwers
MP3::Info - Manipulate / fetch info from MP3 audio files by Chris Nandor, http://pudge.net/
Not thoroughly tested.
Leif Jonsson <email@example.com>