MP3c and batch-files
--------------------

MP3c has two different modes: an interactive mode, where you can use the
menu-environment to do what you want, and the non-interactive mode (also called
batch-mode), where only a shell script for automatic encoding is created.

You can create batch-files in both modes.
1) In interactive-mode press F5 or '5' to open a directory-requester where the
batch-file should stored. Select the destination-directory, press F1 and then
enter the filename you want to use. Voila, your script-file is created. The
advantage in interactive-mode is that your current settings would be used. So
you can first enter all data in the correct way, and select the tracks you
want to encode (in non-interactive mode, all tracks would be used).

2) In non-interactive mode you start MP3c with -b option, followed by the
filename for your new script:
>[ws1ls@excelsior src]$ ./mp3c -b mp3c-batch1
>WSPse MP3c - Batchmode, noninteractive
>reading config
>loading configuration
>configuration loaded
>reading TOC of cd
>building up data tree
>lookup CDDB entry
>look in local CDDB
>building shellscript
>ready...

Furthermore you can add the following options:
-i <config-file>, to define another config-file from default.
-d <cdrom-device>, to define another cdrom-device.

New in version 0.20 is the option:
-t <temp-dir>, to define where ripped files should be stored before encoding.
This Option overwrites tmp-directory definition from config-file.

The batch/script-files:
-----------------------
MP3c V0.19 (and older versions) created script-files without any options, they
would only do for what they were created. With V0.20 this files are totally
different.
While creation of the new script-files, MP3c does not look for the settings of
"on-the-fly encoding flags" and "rip first, before encoding" any longer.
The magic is now in the script-files itself.

You can see all available options, if you call the script with "-h" parameter:
>[ws1ls@excelsior src]$ ~/mp3c-batch1 -h
>
>Available options for this script:
>-1: rip tracks only and exit
>-2: only encode (tracks must be already ripped for this)
>-3: create mp3's on the fly
>-a <order>: rip and encode by <order> (default)
>  order = 0: encode track directly after ripping
>  order = 1: first rip all tracks and then start encoding (default)
>-v: activate verbose mode
>-O: disable STDOUT from external programs
>-o: enable STDOUT (default)
>-E: disable STDERR (default)
>-e: enable STDERR
>-V: show script-version information
>-h: this help

Well, let us look at the different options:
The first thing is the verbosity of the script. Normally there is a great
overhead from ripper and encoder-program, particularly if on-the-fly encoding
is used. You have the possibility to control the stdout and stderr-messages
separately. By default the script would show the output from stdout, but hide
all output coming from stderr. You can control this with the options -o, -O,
-e and -E. In most cases it makes sense to use "-O -E" to ignore any output.
Well, not only the external programs want to talk, also the script itself. You
can use the "-v" option to switch the script into the verbosity modus. It will
then tell you which track is ripped or encoded, in generally whats going on.
I think it is a great deal to use "-v -O -E", so you have only a small, but
informative output (great if used from cron-jobs, etc).

Now to the interesting part of the script-modi:
-1: If you use this option, the cd is read and each track is ripped (and saved
    into the the temp-dir). After this, the script will exit.
-2: This is the option you should use, after running the script with "-1",
    because it will encode the temp-files, set mp3-id tags and updates the
    m3u-playlistfile. After all tracks are ready, the script exits.
-3: If you use this option, all tracks will be encoded in on-the-fly modus.

If you plan to encode one cd by another, there are two further modes:
-a 1: All tracks will be ripped and then encoded. This is like calling the
      script two times, first with "-1" and then with "-2". You see "-a 1" is
      a short form for this, without existing after ripping the cd.
-a 0: This mode would do the same like "-a 1", but you don't need so much
      memory on your hard disk, because encoding is done after a track is
      ripped.

Rip more than one cd before encoding
------------------------------------
So, this is easily done, with these new batch-files (with a newer version it
will be possible to do this even in interactive-mode).
First create batch-files for your cds you want to encode, and start each
script-file with "-1" (hope you have enough disk space ;-). After you ripped
all the cds, you can start the script-files with "-2".

Lets say you want to encode 3 cds:
a) insert first cd and type:
     mp3c -b batch1 && ./batch1 -1 -v -O -E
b) change cd now, and insert the second one:
     mp3c -b batch2 && ./batch2 -1 -v -O -E
c) so, now your tmp-directory is full, but you have the partition /mnt/part2
   with some more diskspace. So insert the third cd:
     mp3c -b batch3 -t /mnt/part2/ && ./batch3 -1 -v -O -E

At this moment all tracks are ripped and sit safely on your harddisk (so
you give the cds back to your friends, eh ;-). Since encoding takes a lot of
CPU-cyles you might want to do this over night. No problem at all. Just type
this, before going to bed:
     ./batch1 -2 -v -O -E && ./batch2 -2 -v -O -E && ./batch3 -2 -v -O -E
And in the next morning (if you have a fast CPU ;-) all your new mp3-files are
ready.

Matthias Hensler, WSPse, 8/1999 (written)
Matthias Hensler, WSPse, 3/2000 (updated)
