/* ** AREXX Script for a DOpus GUI MPEG-Soundplaying Layer 2&3 ** Displays Songname, MPEG-Quality, Playtime in a Dopus Progress Window. ** ** Needed: Directory Opus V5.5+ (© by Jonathan Potter & GPSoftware) ** mpega >= V3.0 (© 1995-97 by Stephane Tavenard) ** ** Optional: ** Melody MPEG-Soundcard (© 1997 KATO) ** MPEGPlay by Thorsten Hansen V1.0+ ** PeggyPlus MPEG-Card (© Ingenierbuero Helfrich) ** Toccata, Prelude, Delfina-Soundcard & other Soundcard with AHI-Driver ** AHI Retargetable Audio System (© by Martin Blom) ** ** ** $VER: PlayerMP2.dopus5 2.0 ** Copyright © 1995-1997 Eckhard Ludwig (Eckhard@top.east.de) ** ** EmailWare: ** This program is Email-Ware ! ** ** Installation: ** Create Button, Usermenu, ... "MPEG Audio Player" : ** --------------------------------------------------------------- ** [ARexx] DOpus5:ARexx/PlayerMP2.dopus5 {Qp} ** --------------------------------------------------------------- ** Set All Flags Off ** ** Install the Filetypes (ID = MP2 for Layer2, ID = MP3 for Layer3)! ** ** Usage: ** Select all .mp2/3/a files and click the Button "MPEG Audio Player". ** If you want to skip a sound a file press the abort button. ** To abort the complete Player abort two soundplayings in the first 5 secs. ** ** Deutsch: ** Programm: PlayerMP2.dopus5, Universeller Opus5 MPEG Audioplayer (Layer 2&3), ** unterstützt MPEG-Karten (Layer 2), Soundkarten (AHI), Amigasound (Setup ** über "Player-Setup" !). Für deutsche Texte PlayMP2.catalog installieren. ** ** Selektiere MP2/3 Files und wähle den Button "MPEG Audio Player" ** Alle Selektierten Titel werden gespielt. ** Wenn anderer MPEGPlayer (PlayMP2.dopus5, PlayMP2.rexx) ** gerade läuft, wird dieser zuvor sofort beendet. */ /*--------S E T T I N G S : ------------------------------------------- ** If the file ENV:PlayMP2.prefs exists, that one will override the ** settings here (Use Player-Setup)! */ /* Auswahl Player: AUTO Auto MELODY Melody Soundcard PEGGYMELODY PeggyPlus Card with Melody MPEG-Player CD32 CD32 FMV-Modul with Melody MPEG-Player (not tested!) PEGGYPLAYER PeggyPlus Default MPEG-Player MPEGA Softwareplayer */ Player = "AUTO" PlayMPEG = "C:mpega" /* Path Softwareplayer */ PlayMelody = "C:MPEGPlay" /* Path Melody Hardwareplayer */ MPEGA_OPTIONS="-p0 -T -f0 -d2 -q2" /* MPEGA Optionen, Vorgabe: Amiga Paula */ BREAKMPEG = "C:BreakName" /* Path MPEGA Breaktool */ options results parse arg portname if portname='' then portname='DOPUS.1' If ~SHOW("P",portname) THEN DO SAY portname' is not a valid port!' exit end address value portname dopus version if (result='RESULT' | TRANSLATE(result,'.',' ') < 5.1218) THEN DO dopus request '"This script requires DOpus V5.5 or greater." OK' exit end signal on syntax options failat 21 lf='0a'x if open(1,'env:PlayerMP2.prefs','R') then do do i=1 to 6 prefs.i = readln(1) end if prefs.2 ~="" then PlayMelody=prefs.2 if prefs.3 ~="" then PlayMPEG=prefs.3 if prefs.4 ~="" then BREAKMPEG=prefs.4 if prefs.5 ~="" then MPEGA_OPTIONS=prefs.5 if prefs.6 ~="" then Player=prefs.6 drop prefs. call close(1) end if ~show('l','rexxsupport.library') then call addlib('rexxsupport.library',0,-30,0) /* init locale */ if ~show(l,'locale.library') then call addlib('locale.library',0,-30) if show(l,'locale.library') then catalog=opencatalog('PlayMP2.catalog','english',0) if ~openport('mpegport') then exit /* 2. Programm-Aufruf wird ignoriert */ lister query source handle=result if rc>0 then do dopus front dopus request '"'getcatstr(0,'Error ...'lf''lf'No source selected !')'"' getcatstr(1,'Quit') call closeport('mpegport') exit end lister query handle numselfiles if result=0 then do dopus front dopus request '"'getcatstr(2,'Error ...'lf''lf'No files selected !')'"' getcatstr(1,'Quit') call closeport('mpegport') exit end lister set handle busy on lister query handle path QuellPfad=result lister query handle selfiles stem files. lister set handle progress files.count getcatstr(4,'Scanning files ...') lister refresh handle full k=0 do i=0 to files.count-1 lister query handle abort if result then do k=0 leave end lister set handle progress count i lister set handle progress name files.i Titel=Quellpfad||files.i dopus getfiletype '"'Titel'"' id DT=result if DT="MP2"|DT="MP3" then do lister query handle entry '"'files.i'"' stem fileinfo. SONG.k=Titel' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment k=k+1 end lister select handle '"'files.i'"' off end lister refresh handle full lister set handle busy off if k=0 then do /* Keine MPEG-Files dabei */ dopus front dopus request '"'getcatstr(3,'Error ...'lf''lf'MPEG Audio files not selected or'lf'MP2/MP3 Filetypes not installed ?!')'"' getcatstr(1,'Quit') call closeport('mpegport') exit end If Player="AUTO" then do SELECT WHEN exists("DEVS:melodympeg.device")&exists(PlayMelody) then Player="MELODY" WHEN exists("DEVS:peggympeg.device")&exists(PlayMelody) then Player="PEGGYMELODY" WHEN exists("DEVS:mpeg.device")&exists(PlayMelody) then Player="CD32" WHEN exists("DEVS:peggympeg.device")&showlist("A","PEGGYPLUS")=1 then Player="PEGGYPLAYER" OTHERWISE Player="MPEGA" END end if ~exists(PlayMPEG) then do ADDRESS VALUE portname dopus front dopus request '"'getcatstr(9,'Fatal Error ...'lf''lf'MPEGA by Stephane TAVENARD not found !'lf'path to command: '"'%s'"'',PlayMPEG)'"' getcatstr(1,'Quit') exit end if ~exists(BREAKMPEG) then do ADDRESS VALUE portname dopus front dopus request '"'getcatstr(10,'Error ...'lf''lf'Breaktool by Kai Iske not found !'lf'path to command: '"'%s'"'',BREAKMPEG)'"' getcatstr(6,'OK') end else address command BREAKMPEG" "PlayMPEG" C" DUMMY=delay(20) address value portname lister new handle=result lister set handle title getcatstr(5,'Player 2.0 by Eckhard@top.east.de') lister set handle sort date do i=0 to k-1 Zeile=SONG.i SPOS=pos("@SIZE=",Zeile) CPOS=pos("@COMMENT=",Zeile) Titel=left(Zeile,SPOS-2) APOS=lastpos("/",Titel) if APOS=0 then APOS=lastpos(":",Titel) songname=substr(Titel,APOS+1) lister add handle '"'songname'" 'substr(Zeile,SPOS+6,CPOS-SPOS-6)' -1 'i+1' r 'substr(Zeile,CPOS+9)'' lister select handle '"'songname'"' on lister set handle display name size comment end lister refresh handle full lister set handle busy on lister query handle selfiles stem files. LISTER SET Handle newprogress name info bar abort lister refresh handle k=files.count ABBRUCH=getcatstr(12,'For Quit press now Abort:') do j=0 to k-1 Titel=left(SONG.j,pos("@SIZE",SONG.j)-2) if ~exists(Titel) then iterate ADDRESS VALUE portname dopus getfiletype '"'Titel'"' id DT=result APOS=lastpos("/",Titel) if APOS=0 then APOS=lastpos(":",Titel) songname=substr(Titel,APOS+1) if songname ~=files.j then do j=j-1 iterate end SEC=0 If DT="MP3"|Player="MPEGA" then do if Player="PEGGYPLAYER" & show('P','Peggy') then address 'Peggy' QUIT If (Player="MELODY"|Player="PEGGYMELODY"|Player="CD32") & show('P','MPEGPLAY.1') then address 'MPEGPLAY.1' 'QUIT' address command "RUN >NIL: "PlayMPEG" PIPE:MPEGAOUT" if ~Open('MPEGAOUT','PIPE:MPEGAOUT','r') then do address command BREAKMPEG" "PlayMPEG" C" ADDRESS VALUE portname dopus front dopus request '"'getcatstr(7,'System Error ...'lf'DEVS:DOSDrivers/PIPE not installed !')'"' getcatstr(1,'Quit') leave end MPEGAV = readln('MPEGAOUT') parse var MPEGAV MPEGAV "(C)" do until readln('MPEGAOUT')="" end BUFFER="" DUMMY="" DO UNTIL DUMMY='0D'x DUMMY=readch('MPEGAOUT',1) BUFFER=BUFFER||DUMMY end parse var BUFFER PM":"PS" "LAYER TIME=PM*60+PS ADDRESS VALUE portname LISTER SET Handle newprogress title PM":"PS" "MPEGAV DO UNTIL Eof('MPEGAOUT') COUNT=ReadCh('MPEGAOUT',6) if PM>=0 then do LISTER SET Handle NEWPROGRESS INFO PM":"PS" "songname if SEC=4 then LISTER SET Handle newprogress name j+1" / "k" "substr(LAYER,5,25) if SEC<4 then LISTER SET Handle newprogress name ABBRUCH' '4-SEC LISTER SET Handle NEWPROGRESS bar TIME SEC end SEC=SEC+1 PS=right(PS-1,2,0) if PS<0 then do PS=59 PM=right(PM-1,2,0) end LISTER QUERY Handle abort IF RESULT THEN leave packet=getpkt('mpegport') if packet~='00000000'x then do Arg1=getarg(packet,0) reply(packet,10) address command BREAKMPEG" "PlayMPEG" C" if Arg1="STOP"|Arg1="ENDE"|Arg1="STOP" then call Ende end end address command BREAKMPEG" "PlayMPEG" C" CALL Close('MPEGAOUT') if TIME>5 & SEC<6 then leave end if DT="MP2" & (Player="MELODY"|Player="PEGGYMELODY"|Player="CD32") then do if Player="MELODY" & exists(PlayMelody) & ~show('P','MPEGPLAY.1') then do call pragma('STACK',10000) address command 'run >NIL: NIL: NIL: =4 then LISTER SET Handle newprogress name j+1" / "k else LISTER SET Handle newprogress name ABBRUCH' '4-SEC DUMMY=Delay(48) address 'MPEGPLAY.1' 'playstate' if result=1 then leave SEC=SEC+1 PS=right(PS+1,2,0) if PS=60 then do PS="00" PM=right(PM+1,2,0) end packet=getpkt('mpegport') if packet~='00000000'x then do Arg1=getarg(packet,0) reply(packet,10) address 'MPEGPLAY.1' 'stop' if Arg1="STOP"|Arg1="ENDE"|Arg1="STOP" then call Ende end LISTER QUERY Handle abort IF RESULT THEN leave end address 'MPEGPLAY.1' 'stop' if SEC<5 then leave end if DT="MP2" & Player="PEGGYPLAYER" then do if showlist("A","PEGGYPLUS")=1 & ~show('P','Peggy') then do call pragma('STACK',8192) address command 'run >NIL: 0 parse var msgstring fore '%s' aft CNT=CNT+1 msgstring=fore||insert.CNT||aft end return msgstring /*---------------------------------------------------------------*/ syntax: if rc=13 then call Ende /* Melody oder Peggy wurde über GUI beendet */ say 'Syntax Error' rc',' errortext(rc) 'in line' sigl'.' return