NAME ABSTRACT DESCRIPTION Internals TODO BUGS Legal stuff | |
A GPL'ed MP3 File Reorganizer GPL © 2000 Frank de Lange |
George - A GPL'ed file reorganizer and CD creator
cd whereever_you_untarred_the_tarball/George-0.2
./george (or perl george)
You can also install George using the provided Makefile.PL:
perl Makefile.PL;make;make install
george
George 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.
The current version of George is available through the project website
http://george.sourceforge.net/
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
programs which 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.
Using the Gnome version of George is really simple. Start up the program by changeing into the George directory and running ./george or perl george. The user interface should pop up, and you can start reorganizing stuff. If George does not start but instead complains about missing modules, your system might not provide access to the required perl modules. To run George, you (or your friendly neighbourhood sysadmin) should make sure at least the following perl modules are installed:
ftp://ftp.gtk.org/pub/gtk/perl/ or the Gnome CVS server
http://www.glade.perl.connectfree.co.uk/index.html
If you also 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 uses.
You can find cdrecord and mkisofs through Freshmeat
http://freshmeat.net
Or go directly to their native site at
http://www.fokus.gmd.de/research/cc/gloneemployees/joerg.schilling/private/cdrecord.html
Once you have George up an running, you'll be presented with a three-page notebook interface. The interface is sequentially organized, so you start on the first page and work your way to the last to turn your files into a neat stack of tried-and-true CD's. I'll go over the notebook pages one by one to give an idea of their purpose and functionality. By the way, if you want to have some pictures of what I'm talking about here, have a look at the HTML documentation which is included with the package and available online at the George project website at
http://george.sourceforge.net/doc/0.2
Source Selection (Tracks) | Source Selection (Albums) |
---|---|
Target Selection | Create CDs |
---|---|
The Source Selection page contains all you need to gather files from all around your system or network into a George project. There are several ways to enter files into a project. The easiest way to start is to type a directory name into the Source Directories entry, or click the Browse button to get a file requester to enter a directory. The directory will be added to the list, but nothing more will initially happen. You can add more directories to this list if needed. George also can take input from filelists. These filelists can be generated by George itself, or they can be produced using the GNU find tool. If you want to learn how to create these lists, look in the Filelists section of this manual. Once you are done adding files to your project, you need to tell George to create the album listings. To do this, press the Refresh button or select Refresh from the Project menu. The Tracks and Albums lists will be filled with your files. You can now remove unwanted files or albums using the context menu which appears when the right mousebutton is clicked. You can select multiple files at once by dragging the mouse while holding down the left button (left-side mouse users please read right where I say left), or by pressing shift or ctrl and clicking on another table entry. This is all standard GTK stuff, nothing fancy.
Once you are happy with your file selection, you can go to the next notebook page labeled Target Selection. The Refresh button (and menu option) will be grayed out now, while the Organize button and menu will be active. This is to indicate that you should not change the source selection after `Organizing' your files, since doing so would undo all the work you have done on the Target Selection (and also the Create CDs) pages. To start organizing, press the Organize button or select the Organize option from the B>Project> menu. George will grind away for a moment, and come back with a list pf `proposed CDs'. You can leave this list as it is and directly go to the next page, but you may also edit the CDs by shuffling albums from one CD to the other. You can also remove albums from CDs without putting them on another CD (they will remain in the `Available Albums' list where but they won't show up on your CDs). You use the Add and Remove buttons to shuffle albums around. To remove one or more albums from a CD, select them and press the Remove button (or right-mouseclick and select remove from the context menu, or select Cut from the Edit menu in the menubar. Isn't choice a wonderful thing?). To add albums to a CD, select the albums to add from the `Available Albums' list and select ONE CD from the `Proposed CDs' list to add them to. Then, press the Add button or use the menus as described above. By the way, you can currently only remove and add albums, it is not (yet) possible to remove entire CDs from the list. You can of course remove all albums from a CD, but then you're left with an empty CD.
Once you're done organizing, go to the last notebook page to actually create CDs. The Organize and Refresh buttons and menus wil be grayed out once you enter this page, while the Create Cuesheets button and menu will be active. Press this button or select this menu to create the Cuesheets for your CDs. These cuesheets contain directions for mkisofs (the pre-mastering program used by George) which files to add to the filesystem which will then be `burned' to CD by cdrecord (the mastering program used by George). George will create one cuesheet file for each CD in the list. These files are saved to a directory named `cuesheets' under the current project directory. Use the Settings-Preferences> menu or Preferences toolbar button to change the project directory, filename template or index numbers for these files. You will also need to enter the recorder device to use. Please note that the default settings include Simulate Write, which means that George (or cdrecord to be more precise) will not actually turn on the laser in the CD-recorder. Once you are sure everything works as planned, and your system is fast enough to allow for on-the-fly CD-creation without using image files, turn off this setting to start creating CDs. I strongly suggest you first try a test run though...
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, somethign which is only permitted for processes which run with root privileges. You have the choice between running George (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.
Once you are happy with the settings, press the Create CDs buttons or select the Create CDs option from the Project menu to create the cuesheets. The CDs will be entered in the list. To create a CD, select it in the list, put a blank CDR or CDRW (if supported by your drive) in your recorder device, select the CD you want to create, and hit the Create CD button (or do the context menu trick). During CD creation, the interface will be rather slugghish. This is due to the fact that perl, being single-threaded, has to jump through loops to update the interface while keeping the child process (mkisofs and cdrecord) running and happy.
If you are using a CDRW and you want to stop the process in mid-flight, press the Cancel button. You will be asked to confirm this unless you deselected the `Confirm Actions' option in the preferences. You can also cancel a regular CDR session, but that will produce a `coaster' while you can just blank a CDRW to reuse it. Once the process is complete, a date will be entered in the `Created' column in the CD list. If you want to, you can verify the CD by inserting it in the verification device and pressing the Verify CD button. If you have a normal CD-ROM reader next to the CD-recorder, it is best to use that for a verification device since a CD-recorder sometimes fails to detect certain errors which make the CD unuseable on read-only devices. To select a verification device, enter the mount point for the device in the preferences dialog. This mountpoint should be present in the /etc/fstab file, and it should be associated with a valid device.
In the previous discussion the Preferences dialog was mentioned a few times. While I'm at it, I might as well describe the options this thing has to offer. You open it through the Settings-Preferences> menu or the Preferences toolbar button. The dialog which pops up has five pages, and should be mostly self-explanatory. If you hover your mouse pointer over an option (not over the labels) you should get a hint to the meaning of that particular option. I'll quickly go over the pages now.
Defaults | External Programs | Devices and Media | Identifications | User Interface |
---|---|---|---|---|
This page contains all kinds of default settings. The important ones to fill in before using George are the Working directory (defaults to a directory called `.george' in your home directory) and the project directory (defaults to `project'). You can also pick names for various files George produces, as well as the index number George uses for the next CD it creates. George creates names for the CDs it creates based on the CD name template, followed by a dash (`-') and an index number.
Here you get to enter the paths to mkisofs, cdrecord and cmp. The latter is used for verification of CDs. The verification consists of a simple file-by-file comparison against the original files.
On this page you need to enter the SCSI (or emulated SCSI) bus, address and
Logical Unit Number (LUN) for you CD-recorder. If needed, you can enter a
device name (eg. /dev/sg1) for the CD-writer, but most systems do not need this (older versions of
FreeBSD need it, Linux does not). You can also enter the size of your blank
CDR(W)-media
in 2K-blocks or bytes (your choice). The default
settings are for 74-minute/650 MB media, which are the most common. The
write speed can be set to the maximum your CD-writer supports, but it may
be necessary to set it to a lower speed if your system can not keep up with
your recorder. George offers on-the-fly CD-creation without using image
files by piping the output from the pre-mastering program (mkisofs) directly to the mastering program (cdrecord). This was tested at 4x speed on a P166 with 96 MB of RAM under Linux, and
worked flawlessly. If your system does not manage to keep up, simply lower
the write speed until it does. If it does not keep up at 1x speed you need
a new system (or you need to reconfigure it...).
The Write options should be OK for most purposes. Be aware of the fact that George defaults to Simulate Write, which means that it will NOT create CDs without turning this option off. This is a safety precaution to make sure you test your system before blaming George for the stack of coasters you just created...
On this page you can enter the application ID and Publisher ID for the CDs you create. These are optional parameters. The Application ID should describe the `application' which is on the CD (it defaults to `mp3 audio'), the Publisher ID should contain some information on you including a phone number or email address.
This contains the font settings for the textbox on the `Create CDs' notebook page and some miscellaneous options. On my system, the font selector always says `Times 14', which is not correct. The default font is actually Lucidatypewriter 10, but the Gnome font widget does not seem to want to show this. Don't worry, if you select a font it will be used. You can turn on Verbose monitoring if you want to see all output from external programs in the text window. The Confirm Actions setting allows you to turn off the OK/Cancel dialogs which pop up every now and then. The Debug option is intended for developer who want to see debugging info on the terminal from which George was started. The amount of debugging info it produces varies, since some parts of the program contain more debugging hooks than others.
George nedds 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 arched 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, 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. George won't recognize you files without it.
George 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 Geroge 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:
Wolfe_Tones/=/mnt/ext2/1/Wolfe_Tones/Wolfe_Tones-The_Foggy_Dew.mp3
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:
/Wolfe_Tones/Wolfe_Tones-The_Foggy_Dew.mp
George needs a couple of modules of its own to function correctly. Currently the list includes the following `private' modules:
George.pm
GeorgeUI.pm
GeorgeMenu.pm
GeorgeDialog.pm
GeorgePixmaps.pm
GeorgeMessagebox.pm
Cd.pm
Album.pm
Track.pm
Media.pm
george_logo.xpm
All these files reside in the lib directory of the distribution. If you run George directly from this directory, they should be found. If you instead use the makefile to install George somewhere on your system, they will probably land somewhere in your site_perl directory. George should still work OK, although it is possible that the logo pixmap won't show up in the About box. You can blame this on the vaguaries of the Gnome::About class.
George is not finished. Ther are many things which could and should be added, changed and/or improved. To name just a few:
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 > george.html
This creates the documentation for the command-line version of George:
pod2html --noindex --title "George - Reorganize your MP3 collection"
george-command > george-command.html
Zarro Boogs Found, to paraphrase Bugzilla. Well, that's only because I haven't looked good enough. 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 <frank@unternet.org>
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>