Short: ARexx script for FreeDB to copy CD tracks Author: Michael.Merkel@gmx.net (Michael Merkel) Uploader: Michael Merkel gmx net (Michael Merkel) Type: mus/misc Version: 1.10 Replaces: mus/misc/FreeDB_CopyTracks.lha Requires: Amiga OS4, FeeDB, lame, id3edit, eject, rmh.library Architecture: generic Distribution: Aminet ABOUT ----- FreeDB offers you the possibility to query a CD database for your currently inserted audio cd. With this script the content of this CD is then copied to your harddisk (using the OS4 CDFS and lame (or another encoder)) as MP3 or OGG and the FreeDB data is used to set the ID3 tags inside the MP3/OGG file. Also the FreeDB data is used to structure the files on the harddisk like following: HDx:(artist)/(album)/(track).mp3 The structure of the files can easily be set by ENV variables. It never has been easier to copy your whole CDDA collection to your harddisk! Really! REQUIREMENTS ------------ you need the following programs: - FreeDB by Alfonso Ranieri (http://alfie.altervista.org/freedb/index.html) - lame (http://os4depot.net/share/audio/record/lame.lha) (or bladeenc or oggdec and oggcomment) - id3 (http://os4depot.net/share/utility/filetool/id3edit-os4.lha) - eject (http://www.rcdrummond.net/amiga/index.html) - rmh.library by Alfonso Ranieri (http://alfie.altervista.org/soft/rmh.html) INSTALLATION ------------ copy it to your arexx directory (e.g. S:Arexx/) 1. preparations --------------------------------- Just start the script. It will try to read some ENV variables. If they are not present yet the script will use default values and create those variables. So you can edit them afterwards. The following ENV variables can be set in "ENVARC:FreeDB/..." with either a text editor or using "SETENV SAVE FreeDB/..." in a shell. * mainTargetDir = "Big_Cache:MP3/LOCAL" The main path the MP3s will be decoded to * sourceDir = "CD1:" The CD ROM device the audio CD is placed in. Used as source for a simple "copy" command as Amiga OS4s CDFS offers the ability to read audio data as aiff. This is then directly used by lame to decode it as MP3. * sourceTrack = "Track%track" Name of the source track on the CDDA. "%track" is replaced by the track number (see below) * sourceTrackLen = "2" Length of the track number in the source file * mp3DirPattern = "%CDartist/%CDtitle" The pattern for the mp3 directory strcuture. The shown default will generate a subdirectory with the name of the artist and there a subdirectory with the title of the cd. (for the possible variables see below) Example: The main path is "Big_Cache:MP3/LOCAL", the CD is "in blue" from "The Corrs". The path for the encoded mp3s will be: "Big_Cache:MP3/LOCAL/The Corrs/in blue" * mp3FilePattern = "%track_%title.mp3" The pattern for the encoded mp3 files. The shown default will generate the name starting with the tracknumber followed by a "_" and the title of the track followed by ".mp3" (for the possible variables see below) Example: The first Track of "The Corrs" CD will be generated like this: "01_Breathless.mp3" * mp3FileTrackLen = "2" Length of the track number in the generated mp3 file * EncoderMode = "MP3" The enocder mode. "MP3" will use LAME, "OGG" will use ogg vorbis. * mp3Encoder = "C:Lame --preset standard --abr 192 --noreplaygain %SRC %TRG" The enocder command. The two special variables %src and %trg will be replaced by the source filename and the target (mp3) file name. In comments you can find the call for use with the lame alternative "bladeenc". * id3Command = "C:ID3" Where to find id3 (usually C:ID3) * useMp3Id3Tags = "YES" If set to "YES" lame is used for writing the id3 tags instead of id4Command (default) * mp3Id3Tags = '--tt "%title" --ta "%artist" --tl "%CDtitle" --ty "%CDyear" --tc "%comment" --tn "%track" --tg "%CDgenre" --ignore-tag-errors' The id3 tag line for lame to be used. You should not touch this. * oggEncoder = "C:oggenc --quality 3.5 -o %TRG %SRC" The ogg enocder command. * oggCommentCmd = "C:vorbiscomment" The tool to comment ogg files * ejectCommand = "C:Eject" Where to find eject (usually C:eject) * tmpCommandFile = "T:FreeDB_CopyTracks.tmp" Filename for temporary commands. No need to change! Inside the script you can specify character conversion rules. What is currently in the script (subroutine INIT) should NOT be removed! e.g. * Call AddCharConv( ':', '_' ) * Call AddCharConv( '"', '' ) * Call AddCharConv( '/', '|' ) These character conversion rules are used for: files, title, author, comment, ... They have the following meaning: If the title/author/comment contains a ":" it will be replaced by a "_". and so on... It should be obvious that ":", and "/" can not be used as a directoryname or filename. Also a '"' can not be used as it is needed to call the commands. Additionaly multi line comments are truncated to only one line. 1.1. possible variables for the directory and file pattern ---------------------------------------------------------- For "mp3DirPattern" the following variables are possible: - %CDartist - The Name of the Artist of the CD - %CDtitle - The Title of the CD - %CDgenre - The Genre of the CD - %CDyear - The Year of recording of the CD (not always set in FreeDB!) For "mp3FilePattern" the following variables are possible: - (the same like in mp3DirPatter) - %artist - The artist of the song (only sensible if a multiple artist CD) - %title - The Title of the song - %track - The Track number of the Song 1.2. using OGG vorbis ---------------------------------------------------------- There is not much to do to use OGG instead of MP3. Just set the ENV variable "FreeDB/encoderMode" to OGG. You may have to adapt 2. preparations inside FreeDB ----------------------------- Start freedb and go to the settings. There you have to define this script inside the macros section. Also tick the "Use console" checkmark to see the output of the script! USAGE ----- - Insert an audio cd - Get the freedb info (or type it manually and store it) - Select the tracks you want to be decoded (usually - right mouse click and "select all") - Start the script from the macros menu. Have fun!! HISTORY ------- V1.0 (21. Dec 2004) * first version V1.1 (26. Dec 2004) * added conversion routine * added truncation of comments V1.2 (27. Dec 2004) * added requester if target file already exists (overwrite/skip/id3only...) * tried to use lame itself to write the ID3 tags. But id3edit gives better results IMHO. dropped... V1.3 (02. Jan 2005) - HAPPY NEW YEAR! * requester now works :-) * comment restricted to 100 character * added some statistical output at end of generation to find possible encoding errors * possibility to define the directory structure of the mp3 files * possibility to define the filename structure of the mp3 files * possibility to use another decoder than lame (e.g. bladeenc) * default settings for lame changed * opening of CD tray using Richard Drummonds "eject" tool * (attention: settings (names) changed!) V1.4 (05. Jan 2005) * directory creation failed if the name ended with "/x" e.g. The Beatles "1" was not possible to create as "The Beatles/1" * protocoll in overwrite mode was not correct * setting the arexx stack to 500000 at beginning now. One user mentioned lame crashing. V1.5 (20. Feb 2005) * added some more conversion and chenged some, A well known big OS (well...) had problems whith reading filenames containing e.g. "?" and "|"... OS4 has not ;-) * changed all global user defineable variables to ENV variables * added direct support for OGG vorbis files (thanks to Timo Sievänen) V1.6 (13. Mar 2005) * using rmh.library by Alfonso Ranieri now * using rmh to read and write ENV variables. Thanks to Niels Bache for pointing me to the fact that ENV vars should not be read/written like if they are files * Niels Bachee reported a problem with id3 and the genre "fusion". Workaround added. V1.61 (14. Mar 2005) * sorry - I set the debug flag accidently - changed V1.7 (18. Mar 2005) * BIG SORRY - ID3 tags were not written at all. Many thanks to Niels again! V1.8 (3. Oct 2005) * thanks to Markus Lunk for his hints which lead to this update * added sourceTrack to name the track on the source cd * added sourceTrackLen to define the length of the tracknumber on the source cd * added mp3FileTrackLen to define the length of the tracknumber in the target mp3 file * the script should skip ID3 creation now if the source file is not found * CharConv now for titlenames also (forgot this - also thanks to GChris) V1.9 (13. Oct 2005) * added code from Timo Sievänen for writing OGG tags more efficient * fixed syntax error in writing tags in OGG mode V1.9a (14. Oct 2005) * disabled debug mode :-) V1.10 (7. Nov 2005) * reactivated writing of the id3 tags by lame (thanks to Markus Lunk for the request) -> this is the default now and can be DEactivated by setting the ENV variable "useMp3Id3Tags" to "NO" AUTHOR ------ Michael Merkel (MiMe@IRC) Michael.Merkel@gmx.net http://www.mirime.de/Michael/ THANKS TO --------- Hyperion, especially the Frieden bros. for making AmigaOS 4 a reality Alfonso Ranieri for his wonderful programs - especially rxMUI, ContactManager and FreeDB