home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Multimed / Multimed.zip / lbraplay.zip / RAStream.cmd < prev    next >
OS/2 REXX Batch file  |  1999-04-22  |  923b  |  39 lines

  1. /* This is a REXX script for .ra streaming / processing .ram files.
  2.  Requires WGET */
  3.  
  4. /* WGET name and parameters to pipe the output to stdout */
  5. WGET='wget -O -'
  6. /* RAPlay name */
  7. RAPLAY='RAPLay'
  8.  
  9. Parse Arg In
  10. if word(In,1)='' then do
  11.    say 'Usage: RAStream {.ram file|.ra file URL}'
  12.    exit
  13.    end
  14.  
  15. /* This is a workaround for a weird thing: the command line parameter is cut
  16. at '//' */
  17. do while queued()<>0; parse pull; end
  18. '@echo %1|rxqueue'
  19. parse pull In
  20. In=strip(In)
  21.  
  22. if pos('://',In)<>0 then do    /* It's an URL */
  23.    URL=In
  24.    call ProcURL
  25.    exit
  26.    end
  27.  
  28. do while chars(In)<>0
  29.    URL=linein(In)
  30.    call ProcURL
  31.    end
  32. exit
  33.  
  34. ProcURL:
  35.    if translate(left(URL,4))='PNM:' then URL='http:'substr(URL,5)
  36.    if (translate(left(URL,4))='FTP:')|(translate(left(URL,5))='HTTP:') then '@'WGET URL'|'RAPLAY '->nul'
  37.    else if word(URL,1)<>'' then say 'Not a valid URL:' URL
  38.    return
  39.