Short:    Shows TOC of AudioCDs in various ways
Author:   amiga@rripley.de (Ralph Reuchlein)
Uploader: amiga@rripley.de (Ralph Reuchlein)
Version:  1.0
Type:     disk/cdrom
Kurz:     zeigt TOC von AudioCDs in vielen Varianten
Date:     09-Jan-2000

                               ShowTOC
                               =======


PURPOSE

   Since I own a CD burner I made my own compilations from various CDs
   including AudioCDs containing my favourite Amiga modules.  I also
   create my own CD labels I print and stick on my burnt CDs.  Now I
   had the problem to find out the length of each burnt track and the
   information provided by the source CDs is wrong in most cases, so I
   decided to write a program that prints the contents of an AudioCD
   in a configurable way.

   This software is eMailware, which means, that if you like this
   piece of software, you have to write me an eMail (address see end
   of readme).


HISTORY

   v1.0:
   - public release



INSTALL

   Simply unpack the archive to anywhere you want.  I prefer to copy
   the executable to C:.



REQUIREMENTS

   - OS 3.0 and higher
   - CDROM
   - AudioCDs :-)



USAGE

   The template is

      DEVICE=D/K/A,UNIT=U/N/K/A,FORMAT=FMT/K,INTRODUCER=INTR/K,CDIDDIR/K,
      HEADFORMAT=HEADFMT/K,TAILFORMAT=TAILFMT/K,
      NOHEADER/S,NOLIST/S,NOTAIL/S

   You always have to provide the device name of your SCSI interface
   and the unit number of the device, which is usually

      unit = (BOARD * 100) + (LUN * 10) + SCSI_ID

   If you have only one SCSI interface, only the SCSI_ID is needed.

   FORMAT is the format string for each track on CD, HEADFORMAT is
   used for a header of the track list (e.g. CD ID) and TAILFORMAT for
   the end of the track list (e.g. length of CD).  Each of the format
   parameters have default parameter:

      HEADFORMAT: "       CD: %i%\n    Title: %T%\nArtist(s): %a"
      FORMAT:     "Track  %2n: %d  %t"
      TAILFORMAT: "CD length: %f"

   Available format types are:

      %sm   Minutes of start time
      %ss   Seconds of start time
      %sf   frame fraction of start time
      %sd   decimal fraction of start time
      %sa   all frames of start time
      %s    start time with format "%2sm:%02ss;%02sf"
      %sn   number of first track

      %em   Minutes of end time
      %es   Seconds of end time
      %ef   frame fraction of end time
      %ed   decimal fraction of end time
      %ea   all frames of end time
      %e    end time with format "%2em:%02es;%02ef"
      %en   number of last track

      %dm   Minutes of duration
      %ds   Seconds of duration
      %df   frame fraction of duration
      %dd   decimal fraction of duration
      %da   all frames of duration
      %d    duration with format "%2dm:%02ds;%02df"

      %fm   Minutes of full CD time
      %fs   Seconds of full CD time
      %ff   frame fraction of full CD time
      %fd   decimal fraction of full CD time
      %fa   all frames of full CD time
      %f    full CD time with format "%2fm:%02fs;%02ff"

      %n    track number
      %N    number of tracks

      %i    CD id
      %T    Title of CD
      %t    Title of track
      %a    Artist(s) of CD
      %l    TOC length on CD in bytes

      %\n   Special character: New line
      %\r   Special character: Carriage return
      %\f   Special character: Form feed
      %\t   Special character: Tabulator

   As you can see, you have many opportunities to build your own
   format strings.  Usage of format types for tracks in the header or
   tail strings is senseless, but possible (you will get unpredictable
   results).  By the way I have to describe the difference between the
   'frame fraction' and 'decimal fraction':  Each second on an AudioCD
   has 75 frames, therefore I have two ways to show these fraction.
   First I can print out the number of frame in that second (the %xf
   format type, which is default) or I can calculate the decimal
   fraction (1/75th part) of one second (the %xd format type).  For
   example a frame count of 47 (format type %xf) would print a 63
   (rounded up) with the format type %xd, where x is one of s, e, d
   and f.

   Each format type can be formatted like the printf() function from
   the C standard libraries. There is only one restriction: You cannot
   add a type qualifier to the type, e.g. "%lw" (must only be "%w").
   Some examples of formatting:

      %30t  Track title will be displayed in a 30 column wide space.
            If the basename length is less than 30, it will be right
            filled by spaces.
      %-30t Equals %30n, but field will be left filled by spaces.
      %.4t  Truncates track name to 4 characters or will be right
            filled if name length is less than 4.
      %04fm Writes minutes of complete CD in a 4 column wide field.
            If the number has less than 4 digits, it will be left
            filled with zeros instead of spaces.

   For more information refer to the C standard library documentation
   of printf(), sprintf() or fprintf().

   If you use ShowTOC in a script that also uses '%' as format
   introducer, you can switch to another introducer with the parameter
   INTRODUCER, e.g. '$' or '&'.  I recommend non-alpha characters.

   The parameter CDIDDIR is used to retrieve the CD title and contents
   from a so-called CDID file which is supported by many CD-Players
   written for Amiga, e.g. OptyCDPlayer, ACDPlay, etc.  If you do not
   provide that parameter or if ShowTOC cannot find a CDID file for
   your CD, the format types %t, %T and %a were not used.  You can
   find huge CDID archives in the Aminet.

   Finally you can turn off the three output blocks header, list
   and/or tail with the NOHEADER, NOLIST and NOTAIL switches.

   ShowTOC makes no difference between real audio tracks and data
   tracks, therefore you can print a track listing of e.g. an
   Aminet CD.



EXAMPLES

   A call of ShowTOC with the device and unit only

      ShowTOC DEVICE=2060scsi.device UNIT=2

   will return a simple track list:

             CD: ID11009b58037ca6
          Title: 
      Artist(s): 
      Track   1:  4:18;15
      Track   2:  4:31;40
      Track   3:  4:11;45
      Track   4:  4:11;15
      Track   5:  4:30;55
      Track   6:  4:56;10
      Track   7:  4:27;45
      Track   8:  4:02;10
      Track   9:  4:40;02
      Track  10:  5:35;68
      Track  11:  5:21;25
      CD length: 50:46;68

   The lines "Title:" and "Artist(s):" are empty, because ShowTOC
   couldn't resolve the CD's name despite of the lack of parameter
   CDIDDIR.  Using the same command including that parameter

      ShowTOC DEVICE=2060scsi.device UNIT=2 CDIDDIR=AUDIO:disks

   does print out

             CD: ID11009b58037ca6
          Title: Break Every Rule
      Artist(s): Tina Turner
      Track   1:  4:18;15  Typical Male
      Track   2:  4:31;40  What You Get Is What You See
      Track   3:  4:11;45  Two People
      Track   4:  4:11;15  Till The Right Man Comes Along
      Track   5:  4:30;55  Afterglow
      Track   6:  4:56;10  Girls
      Track   7:  4:27;45  Back Where You Started
      Track   8:  4:02;10  Break Every Rule
      Track   9:  4:40;02  Overnight Sensation
      Track  10:  5:35;68  Paradise Is Here
      Track  11:  5:21;25  I'll Be Thunder
      CD length: 50:46;68


   If you are only interested in the ID of the CD, the number of
   frames and the analogue runtime stored on your AudioCD, you simply
   need following shell command:

      ShowTOC DEVICE=2060scsi.device UNIT=2 NOHEADER NOLIST TAILFORMAT="%i: %fa frames = %f mins"

   that returns

      ID11009b58037ca6: 228518 frames = 50:46;68 mins

   It makes no difference if you use TAILFORMAT and NOHEADER or
   HEADFORMAT and NOTAIL, because both will print the same result.


   Final note:  Using NOHEADER, NOLIST and NOTAIL together is silly,
   because you got no outout, but this combination can be used to
   check whether a CD is inserted in your CDROM drive (you will get a
   error message otherwise).



BUGS

   *kough* What's that?



DISCLAIMER

   THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   SUCH DAMAGE.



MISC

   Suggestions and bug reports are welcome, but I think the little
   program's purpose is fully accomplished.



OTHER TOOLS

   picsize        Shows picture dimensions using datatypes
                  (Aminet: util/dtype/picsize.lha, v1.2)

   NewWinBox      Changes window dimension and position
                  (Aminet: util/cli/NewWinBox.lha, v1.0)

   MCD_DirList    Generates file lists for MakeCD
                  (Aminet: disk/cdrom/MCD_DirList.lha, v1.0)



CONTACT

   snail  Ralph Reuchlein
   mail:  Eibseestr. 18c
          86163 Augsburg
          GERMANY
   
   eMail: amiga@rripley.de
   WWW:   http://www.rripley.de
   IRC:   RRipley on #germany


============================= Archive contents =============================

Original  Packed Ratio    Date     Time    Name
-------- ------- ----- --------- --------  -------------
     124      89 28.2% 08-Jan-00 15:36:42  SCOPTIONS
   18764   11829 36.9% 09-Jan-00 17:05:30  ShowTOC
   17599    4578 73.9% 09-Jan-00 17:02:10  ShowTOC.c
    9531    4024 57.7% 09-Jan-00 17:02:12  ShowTOC.readme
-------- ------- ----- --------- --------
   46018   20520 55.4% 09-Jan-100 23:50:12   4 files
