home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2428 / tape.awk < prev    next >
Encoding:
AWK Script  |  1991-01-01  |  2.5 KB  |  97 lines

  1. BEGIN {  
  2.   print "" > "o.tex"
  3.   print "%--------------------------" > "o.tex"
  4.   print "" > "o.tex"
  5.   num_songs = 0;
  6.   num_others = 0;
  7. }
  8.  
  9. # $1  meaning
  10. # --  ---------------------------------------------------------------------
  11. # k   KEY, short, only one word, namely $2
  12. # t   TITLE
  13. # a   AUTHOR / ARTIST
  14. # s   SONG (up to 14 on a side, or more if you use a smaller latex font)
  15. # o   OTHER stuff to put on the back flap of the label or for db search
  16. # c   COMMENT db search text will not appear on the cassette label
  17. # e   END-OF-ENTRY  (very very important)
  18. #
  19. #
  20. #
  21.  
  22. {
  23.   if        (( $1 == "k" ) || ( $1 == "K" )) {
  24.     key = $2
  25.   } else if (( $1 == "s" ) || ( $1 == "S" )) {
  26.     num_songs++
  27.     for (i=2; i<=NF; i++) {
  28.       song[num_songs] = song[num_songs] " " $i
  29.     }
  30.   } else if (( $1 == "t" ) || ( $1 == "T" )) {
  31.     for (i=2; i<=NF; i++) {
  32.       title = title " " $i
  33.     }
  34.   } else if (( $1 == "a" ) || ( $1 == "A" )) {
  35.     for (i=2; i<=NF; i++) {
  36.       author = author " " $i
  37.     }
  38.   } else if (( $1 == "o" ) || ( $1 == "o" )) {
  39.     num_others++
  40.     for (i=2; i<=NF; i++) {
  41.       others[num_others] = others[num_others] " " $i
  42.     }
  43.   } else if (( $1 == "e" ) || ( $1 == "E" )) {
  44.     if ( key == "" ) {
  45.       print "Yo blood!  Jeez, dude, like, ain't no KEY in theya!"
  46.       key = "nokey"
  47.     }
  48.     o = "\\album{" key "}"
  49.     if ( author == "" ) {
  50.       print "Gaddangit blood, you plum forgit da AUTHOR mothalova"
  51.       author = "No Artist"
  52.     }
  53.       o = o "{" author "\\\\"
  54.     if ( title == "" ) {
  55.       print "Sheeeeit, mothalova, you done forgit da TITLE ehyeshoel"
  56.       title = "No Title"
  57.     }  
  58.     o = o "{\\bf " title "}"
  59.     print o > "o.tex"
  60.     o = ""
  61.     if (num_songs > 0) {
  62.       print "\\begin{enumerate}" > "o.tex"
  63.       for ( i=1; i<=num_songs; i++) {
  64.         print "\\item " song[i] > "o.tex"
  65.         song[i] = "";
  66.       }
  67.         print "\\end{enumerate}" > "o.tex"
  68.       } else {
  69.       print "{}" > "o.tex"
  70.     }
  71.     print "}" > "o.tex"
  72.     print "{{\\bf " author "\\\\" title "}}" > "o.tex"
  73.     if (num_others > 0) {
  74.       print "{" > "o.tex"
  75.       for (i=1 ; i<=num_others; i++) {
  76.         print others[i] "\\\\" > "o.tex"
  77.         others[i] = "";
  78.       }
  79.       print "}" > "o.tex"
  80.     } else {
  81.       print "{}" > "o.tex"
  82.     }
  83.     print "%--------------------------" > "o.tex"
  84.     print "" > "o.tex"
  85.     num_songs=0;
  86.     num_others=0;
  87.     key = "";
  88.     title = "";
  89.     author = "";
  90.   } else if ((length($0) == 0) || ($1 == "c") || ($1 == "C")) {
  91.       x="x";
  92.   } else {
  93.     print "Hey, dude.  Like I just saw a weirdo line, skin.  It be:"
  94.     print $0
  95.   }
  96. }
  97.