home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / DOpus / MPEGA-GUIplay.lha / MPEGA-convert.dopus5 next >
Text File  |  1998-05-06  |  3KB  |  168 lines

  1. /* $VER: MPEGA-convert.dopus5 1.7 (06 May 1998)
  2.    ⌐1998 by mike@kily.ruhr.de (http://kily.home.pages.de)
  3.  
  4.  DOPUS5.5+ AREXX Script for MPEGA-Soundconvert to AIFF
  5.  with ProgressBar-GUI with timecounter.
  6.  
  7.  needs:
  8.   DOPUS 5.5+
  9.   MPEGA 3.3
  10.  
  11.   RexxMaster (ARexx) running
  12.   mounted PIPE: device > SYS:DEVS/DOSDRIVERS/PIPE
  13.   kill > Task breaker tool by Magnus Holmgren (included)
  14.  
  15.  description:
  16.   A DOPUS GUI for the Great MPEGA player by Stephane TAVENARD.
  17.   displays Name/MPEG-Quality/Time in a DOPUS PROGRESS Window.
  18.   it shows the runtime on a proggressbar and a timecounter.
  19.  
  20.  installation:
  21.   as Button,Menu,...
  22.   NO Parameters, only select: <AREXX> Dopus5:ARexx/MPEGA-Convert.dopus5
  23.  
  24.  configuration:
  25.   check/change the mpega startup parameters in this script.
  26.  
  27.  EmailWare:
  28.   this script ist Email-ware,
  29.   please mail me your favourit Internet-Site !
  30.  
  31. */
  32. OPTIONS RESULTS
  33.  
  34. convertmode="-WsT -p-30"
  35.  
  36.  
  37.  
  38. PARSE ARG portname' 'handle' 'file
  39.  
  40. IF portname='' THEN portname='DOPUS.1'
  41. ADDRESS VALUE portname
  42.  
  43. IF handle="" THEN DO
  44.  
  45.  LISTER QUERY SOURCE
  46.  handle=result
  47.  IF RC~=0 THEN DO
  48.   DOPUS REQUEST '"no Source-directory selected !?!" OOPS!'
  49.   EXIT
  50.  END
  51.  
  52.  LISTER QUERY Handle selfiles stem files.
  53.  IF files.count=0 THEN DO
  54.   DOPUS REQUEST '"no MPEG sound-files selected !?!" OOPS!'
  55.   EXIT
  56.  END
  57.  
  58. END
  59.  
  60. IF file~="" then DO
  61.  files.0=compress(file,'"')
  62.  files.count=1
  63. END
  64.  
  65. LISTER QUERY Handle path
  66. pfad=result
  67.  
  68. LISTER SET Handle BUSY ON
  69. LISTER SET Handle newprogress name info bar abort
  70.  
  71. DO j = 0 TO files.count-1
  72. IF index(upper(files.j),".MP") >1 then do
  73.  
  74.  LISTER SET Handle NEWPROGRESS NAME "Name: "files.j
  75.  LISTER SET Handle NEWPROGRESS INFO "00:00 / 00:00 / decoding MPEG sound..."
  76.  
  77.  file='"'pfad||files.j'"'
  78.  pos=lastpos('.',files.j)
  79.  fname=left(files.j,pos-1)
  80.  file='"'pfad||files.j'"'
  81.  file2='"'pfad||fname'.WAV"'
  82.  
  83.  ADDRESS COMMAND 'RUN >NIL: <NIL: mpega 'convertmode' -T 'file' 'file2' >PIPE:mpegout'
  84.  
  85.  CALL Open('mpegout','PIPE:mpegout','r')
  86.  
  87.  string = ReadLn('mpegout')
  88.  string=Text( string )
  89.  
  90.  parse var string version "[680"CPU "(C)"dummy
  91.  version=version" "CPU
  92.  
  93.  LISTER SET Handle NEWPROGRESS title j+1' / 'files.count' - 'version
  94.  
  95.  DO until dummy=""
  96.   dummy = ReadLn('mpegout')
  97.  END
  98.  
  99.  string = ReadLn('mpegout')
  100.  string=Text( string )
  101.  
  102.  parse var string dummy"MPEG"MTYPE
  103.  MPGMODE="MPEG"MTYPE
  104.  
  105.  string = ReadLn('mpegout')
  106.  string=Text( string )
  107.  parse var string dummy": "pm":"ps
  108.  
  109.  ptotal=pm*60+ps
  110.  secs=0
  111.  LISTER SET Handle NEWPROGRESS bar ptotal 0
  112.  
  113.  DO UNTIL Eof('mpegout')
  114.  
  115.  time=ReadCh('mpegout',29)
  116.   secs=secs+1
  117.  
  118.   if index(time,"err")>0 then dopus request "error"'0a'x||time
  119.  
  120.   time=left(right(time,10),5)
  121.   if time="" then time=" End."
  122.  
  123.   LISTER QUERY Handle abort
  124.   skip=result
  125.  
  126.   IF skip=1 THEN DO
  127.    ADDRESS COMMAND 'kill MPEGA >nil:'
  128.    if stop<5 & secs<5 then do
  129.     LISTER REFRESH Handle
  130.     LISTER SET Handle BUSY OFF
  131.     CALL Close('mpegout')
  132.     EXIT
  133.    end
  134.    stop=secs
  135.    dummy=ReadCh('mpegout',256)
  136.   END
  137.   ELSE DO
  138.    LISTER SET Handle NEWPROGRESS INFO pm":"ps" / "time" / "MPGMODE
  139.    LISTER SET Handle NEWPROGRESS bar ptotal secs
  140.   END
  141.  
  142.  
  143.  END
  144.  LISTER CLEAR Handle abort
  145.  CALL Close('mpegout')
  146.  LISTER SELECT Handle '"'files.j'"' OFF
  147.  LISTER REFRESH Handle
  148. END
  149. END
  150.  
  151. LISTER SET Handle BUSY OFF
  152.  
  153. EXIT
  154.  
  155.  
  156. TEXT:
  157. PROCEDURE
  158.  TEXT=Arg( 1 )
  159.  esc2=1
  160.  do until esc1=0
  161.   esc1=Verify(text,'1b'x,'m')
  162.   if esc1~=0 then text=delstr(text,esc1,1)
  163.   parse var text d1'[1m'd2'[22m'd3
  164.   text=d1||d2||d3
  165.  end
  166.  
  167. RETURN TEXT
  168.