home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Multimed / Multimed.zip / lame384.zip / lame-batch.cmd < prev    next >
OS/2 REXX Batch file  |  2000-06-23  |  3KB  |  113 lines

  1. /********************************/
  2. /*  Nicks Lame Batch Processor  */
  3. /*                              */
  4. /*       gagravarr@softhome.net */
  5. /*              14/06/2000      */
  6. /********************************/
  7.  
  8. PARSE ARG args
  9.  
  10. '@ECHO OFF'
  11.  
  12. lastarg = WORDS( args ) - 2
  13. IF lastarg < 0 THEN DO
  14.    SAY "Error - please use LAME style commandline options"
  15.    EXIT
  16. END
  17.  
  18. infile = WORD( args, WORDS( args ) - 1 )
  19.  
  20. instart = ""
  21. intemp = infile
  22. go = 1
  23. DO WHILE LENGTH( intemp ) > 0
  24.    PARSE VALUE intemp WITH next "\" intemp
  25.    IF LENGTH( intemp ) = 0 THEN DO
  26.       /* dum de dum */
  27.    END
  28.    ELSE DO
  29.       IF LENGTH( instart = 0 ) THEN instart = next
  30.       ELSE instart = instart"\"next
  31.    END
  32. END
  33.  
  34. IF LENGTH( instart ) > 0 THEN instart = instart"\"
  35. IF LENGTH( instart ) = 0 THEN DO
  36.    IF SUBSTR( infile, 2, 1 ) = ":" THEN instart = SUBSTR( infile, 1, 2 )
  37. END
  38.  
  39. lamearg = ""
  40. pos = 1
  41. DO lastarg
  42.    lamearg = lamearg" "WORD( args, pos )
  43.    pos = pos + 1
  44. END
  45.  
  46. tempfile = 'lamefind.out'
  47. tempfileb = 'lamecheck.out'
  48. PARSE SOURCE ran
  49.  
  50. go = 1
  51. rpath = ""
  52. lpath = ""
  53. tpath = WORD( ran, 3 )
  54. first = 1
  55. DO WHILE go = 1
  56.    IF first = 0 THEN rpath = rpath""lpath"\"
  57.    PARSE VALUE tpath WITH lpath "\" tpath
  58.    IF LENGTH( tpath ) = 0 THEN go = 0
  59.    first = 0
  60. END
  61.    
  62. 'DIR 'infile' /b /-p > 'tempfile
  63.  
  64. rc = LINEIN( tempfile,,0 )
  65.  
  66. DO WHILE LINES( tempfile )
  67.    infilename = LINEIN( tempfile )
  68.  
  69.    infilename = instart""infilename
  70.  
  71.    PARSE VALUE infilename WITH filename ".wav" junk
  72.    PARSE VALUE filename WITH filename ".WAV" junk
  73.  
  74.    posstar = COMPARE(filename,infile)
  75.  
  76.    newwork = " "WORD( args, WORDS( args ) )
  77.  
  78.    PARSE VALUE newwork WITH newstart "*" newend
  79.  
  80.    newstart = RIGHT( newstart, LENGTH(newstart) - 1 )
  81.  
  82.    wanted = RIGHT( filename, LENGTH( filename ) + 1 - posstar )
  83.  
  84.    'DIR 'newstart''wanted''newend' /b /-p 2>&1 | 'rpath'lame-batch2.cmd RECURSIVE FILE CHECK 'tempfileb
  85.  
  86.    fl = LINEIN( tempfileb )
  87.    rc = STREAM(tempfileb,'c','close')
  88.    go = 1
  89. /*   SAY "**"WORD( fl, 1 )"**" */
  90.    IF WORD( fl, 1 ) = "SYS0002:" THEN NOP
  91.    ELSE DO
  92.       SAY "Warning - Target File ("newstart''wanted''newend") Exists!"
  93.       SAY "Overwrite?"
  94.       PARSE UPPER PULL ow
  95.       IF SUBSTR( ow, 1, 1 ) = "Y" THEN go = 1
  96.       ELSE go = 0
  97.    END
  98.  
  99.    IF go = 1 THEN DO
  100.       SAY "Encoding "infilename "As "newstart''wanted''newend
  101.       'LAME 'lamearg' "'infilename'" "'newstart''wanted''newend'"'
  102.    END
  103.    ELSE DO
  104.       SAY "Encoding of "infilename "skipped"
  105.    END
  106. END
  107.  
  108. rc = STREAM(tempfile,'c','close')
  109. 'ERASE 'tempfile
  110. 'ERASE 'tempfileb
  111.  
  112. EXIT
  113.