|A GPL'ed MP3 File Reorganizer|
GPL © 2000 Frank de Lange
George-Command - A GPL'ed file reorganizer and CD creator
./george-command or perl george-command
You can also install George-Command using the provided Makefile.PL:
perl Makefile.PL;make;make install
George-Command is a file reorganizer and CD creator, especially suited for the creation of MP3 archive CD's. It will take files from all around your system and/or network, organize them into somewhat lexicographically sorted CD-sized chunks and provide means to create CDs using external pre-mastering and mastering software. This is the command line version of George, currently a separate program from the Gnome-version which includes a snazzy GUI with buttons and stuff. It is also a quick hack and probably not the best thing since sliced bread, but it has served me well for over 100 CDs.
The current version of George-Command is available through the project website
This is really a pre-release for those who can not wait to get their stuff
organized. It works, but it is not as modular as I would like. It also does
not abide to some good perl programming practices, although it is fairly
robust for the quick hack it really is :-) So if you only want to run perl
use strict and such, wait for the next version. Then again, if you're that worried
about these things, what are you doing running perl in the first place?
The next version will intergrate both the command line version and the Gnome-version in a single modular program. It will most likely also include a history feature which will make it easier to keep track of were you are in a project. But a said, that is all for future versions of George. Let's first get this thing rolling...
George was created out of a simple need, to move my music collection from all kinds of sources to CD-R. It has the ability to gather files from all around and reorganize those files into something which resembles an ordered list of albums (where an album means `anything organized in directories, excluding subdirectories'). It will collate identically-named directories from several sources into one `album', so you can spread your source files all over the system and/or network. As long as you tell George were to find those files, and as long as the access path to those files is fast enough to allow for on-the-fly CD-recording at your preferred speed, George will be able to work with your files.
This is the command line version of George, hence its name George-Command. If you're afraid of command lines, use the Gnome version of George (which is simply named George and is distributed in the same tarball. If you're reading this, chances are you already have George).
To start the program, change into the George directory and run ./george-command or perl george-command. It should give a short explanation of the available options. If you used the Makefile.PL to install George (and hence George-Command) somewhere on your box, you should be able to start the program by simply typing
If you want to use George to actually create the CDs you just organized, you need some extra tools:
You should be aware of the fact that the version of mkisofs which comes with many Linux distributions (including the RedHat versions <= 6.1) is NOT sufficient, since it does not support the -path-list option which George-Command uses.
You can find cdrecord and mkisofs through Freshmeat
Or go directly to their native site at
George-Command recognizes several options on the command line which I'll go over one by one.
Use the filelist FILELIST option to feed George-Command a filelist other than the default. The default filelist is named mp3-files and should reside in the .george-command directory in your home directory. George-Command will create this directory for you if it is not available.
Use this option to get George-Command to write a new filelist to FILELIST or stdout if no parameter is present.
If you use this option, George-Command will create the cuesheets for use by mkisofs. You can use the create_cd script to create CDs using these cuesheets. Be aware that this script might need some editing to work on your system.
Lists all albums George-Command found in the filelist.
List all tracks for all albums.
List the CDs George-Command can create out of your album collection. This prodces a list of CDs with the albums which will go on them. If you want to see the tracks as well, use -list-album-tracks in combination with this option.
Specify the size of your blank CD media (in blocks of 2048 bytes). George-Command uses this to determine when to stop filling a CD...
George-Command uses a couple of external programs to perform the actual CD writing and verification.
To write a CD, you can use the create_cd script with a cd-name-number as parameter. To change things like the CD-writer to use, you'll have to edit the script. I said this was a bare-bones hack, didn't I?
The cdrecord program really wants to have root permissions to do its job. It may need these permissions to access the CD-writer, but that in itself is easily circumvented by chgrp'ing the device files to some specific group, chmod'ding them to 660 or 664 and adding the user who should have access to these devices to this group. The real problems with cdrecord start when cdrecord tries to elevate its scheduling priority, something which is only permitted for processes which run with root privileges. You have the choice between running create_cd (and hence all descending processes including cdrecord) as root, making cdrecord setuid-root (which opens up your system to all kinds of attacks by local users) or trying to run cdrecord as a normal user. On a relatively quiescent fast system this should work, but on a heavily loaded box the chance of failure is rather high.
This script tries to find out if your newly created CD is actually readable and error-free. Set options by editing the script.
This script - which is disabled by default - removes all files which make up a CD (that is, all files in the cuesheet) from your system. It is disabled because it can potentially remove more files than you wish. Edit the script to remove the BEGIN block if you really want to use it, but make sure you heed the warnings... Oh, and did I mention you set options by editing them in the source?
George needs to be able to figure out some characteristics of a file by looking at some value in a textfile, since it is one of the intended goals of this program to be able to use archived source content as input for new CDs. This means that all relevant information has to be gathered at some point and stored in some easily parseable format. The output from the GNU find tool is appropriate for this, so I chose that to be the current `standard' fileformat. To create a filelist for use by George, you need the following incantation of find:
find directory -follow -type f ! -type d -printf 'directory\t%i %k %m %n %u %g %s %Tb %Td %TY %p\n'
or the simpler version of this:
find directory -follow -type f ! -type d -printf 'directory\t' -ls
The first line an edit of the code used in George-Command, the second line is mostly equivalernt except for some weird cases involving symlinks. If you don't want your find to follow symlinks, leave out the -follow part of these commands. The <-type f ! -type d> stuff is there to avoid some problems when following symlinked directories. You may want to experiment with this to get the best results... Whatever you do, don't forget to include the tab between the directory and the rest of the find -ls output. Geroge won't recognize you files without it.
George-Command produces path-list files (which I dubbed cuesheets, 'cause that word has a nice professional ring to it :-) for consumption by mkisofs. These cuesheets consist of lines of filenames, one per line, which mkisofs uses to arrange files on the ISO9660 filesystem it creates. Since you can put a file almost anywhere (within the constraints of the ISO9660 filesystem) on a cdrom no matter its source location, the cuesheets have to provide mkisofs with both the location of the source file as well as the intended location of that file on the CD-ROM. As of version 1.12, mkisofs supports the use of external path-list files, before that you had to feed it these files through standard input. This is the reason why George needs at leat this version of mkisofs. The format of a cuesheet file is simple, it consists of lines containing 'target_directory=source_file' directives. This is an example of a line from a cuesheet:
Everything before the '=' sign is the directory (starting from the implied root directory) on the CD where the file is supposed to go. Everything after the '=' sign is the soure file to use. The actual filename on CD consists of the target directory followed by the basename of the source file, This example would land at:
George-Command needs a couple of modules of its own to function correctly. Currently the list includes the following `private' modules:
All these files reside in the lib directory of the distribution. If you run George-Command directly from this directory, they should be found. If you instead use the makefile to install George (and George-Command) somewhere on your system, they will probably land somewhere in your site_perl directory.
George-Command will be intergrated within George. George itself is not finished. There are many things which could and should be added, changed and/or improved. See the list in the George documentation for an overview of ideas and plans.
Since all this documentation is actually included at the end of the main script source in perldoc format (also known as `pod'), you can generate your own fresh copy using the perldoc tools. The HTML-version was created using this command:
pod2html --noindex --title
"George - Reorganize your MP3 collection" george-command > george-command.html
This creates the documentation for the Gnome-version of George
pod2html --noindex --title
"George - Reorganize your MP3 collection" george > george.html
George-Command has served me faithfully for over 100 CDs, but I'm sure there are lots of bugs in the script since it is really no more than a quick hack. If you want your software to be somewhat more reliable, use George instead. About those bugs... If you find 'm, or even kill 'm, send 'm to me please. Me in this case is Frank de Lange (frank@NoSpAm.unternet.org> ...and don't forget to remove the spam block from that address...
(C) 2000 Frank de Lange <email@example.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Right, that's the standard preamble for the GNU General Public License. If you want to read the full version, you can find it in the COPYING file which comes with George. For the most up to date version go to http://www.gnu.org/copyleft/gpl.html
Frank de Lange <frank@NoSpAmPlEaSe.unternet.org>