home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Usage: SIDList <dir|file> TO <outfile>
- **
- ** $VER: SIDList.rexx 2.0 (9.7.94)
- **
- ** NOTE:
- **
- ** This is Public Domain. That means that you can spread this program
- ** as much as you like, but only if nothing is changed and no money
- ** are beeing charged.
- ** You are not allowed to replicate any portion of the program.
- ** Note also that I take no responsibilities for the use of
- ** this program considering any damage to or failure of your
- ** software, hardware etc.
- **
- ** Plaese let me know if you like this program by sending me a postcard
- ** or something similar to the address below.
- **
- ** This script extracts Song-info from PlaySID One-Part files in <dir|file>
- ** and writes them in plain Database ASCII Delimited format in a specified
- ** <outfile>. <dir> will be listed recursive and if <file> is entered, SIDList
- ** will list only that particular file.
- ** The output data is shown in the following order:
- ** "Name","Author","Copyright","Tunes,StartTune","Path"
- ** You may change this by changing the two "DBaseLine"'s.
- **
- ** Example of commandline:
- **
- ** SHELL>rx SIDList.rexx SID: TO SBData:PlaySIDMusic.lst
- **
- ** Example of output filelist:
- **
- ** A) "Confusion","JCH","1991 Vibrants","1","DATAPAK:SIDMusic/DemoMusic/Vibrants/JCH/Confusion"
- ** B) "Cauldron II","Richard Joseph","1986 Palace","15,8","DATAPAK:SIDMusic/GameMusic/A-C/CauldronII"
- ** C) "Just Died","Banana","1987 T.E.K.","1","DATAPAK:SIDMusic/Ripp Off/Demo-Music/Banana/Just Died"
- **
- ** Speed:
- ** My complete PlaySID Music list is of 1161 Songs, and it took 12.30
- ** minutes to extract them all on my A500 with FastRAM and a SCSI II drive.
- **
- ** My address:
- **
- ** Ulf Diabelez Harries
- ** Åvænget 4, Ellinge
- ** 5540 Ullerslev
- ** Denmark
- */
-
- OPTIONS RESULTS
- SIGNAL ON BREAK_C
- SIGNAL ON BREAK_D
- SIGNAL ON BREAK_E
- SIGNAL ON BREAK_F
- SIGNAL ON HALT
- SIGNAL ON IOERR
- PARSE ARG in_name 'TO' out_name
- IF out_name = '' THEN DO
- PARSE ARG in_name 'to' out_name
- END
- IF out_name = '' THEN DO
- PARSE ARG in_name 'To' out_name
- END
- IF out_name = '' THEN DO
- PARSE ARG in_name 'tO' out_name
- END
- IF out_name = '' THEN DO
- CALL InitVar
- CALL PrintTitle
- ECHO Usage
- CALL CleanUp
- EXIT 20
- END
-
- CALL InitVar
- CALL PrintTitle
- CALL AddRexxSupport('FAIL')
- CALL CheckArgs
- CALL ScanDir
- CALL PrintInfo
- CALL PrintErrors
- CALL CleanUp
-
- EXIT
- /*************************************************************************/
- DoFiles:
- perc = 100 / countfiles
- CALL OPEN(t,TempFiles,R)
- DO UNTIL EOF(t)
- Path = READLN(t)
- IF Path = '' THEN DO
- ITERATE
- END
- cperc = TRUNC(cperc+perc,2)
- ECHO UP||UP'* Processing:'EMPTY||BOLD||Path||OFF||CR'* Done:'BOLD cperc||OFF'%'
- CALL PSIDExtract
- END
- RETURN
-
- PSIDExtract:
- CALL OPEN(f,Path,R)
- IF C2X(READCH(f,8)) ~= '5053494400010076' THEN DO
- ECHO BELL UP
- CALL CLOSE(f)
- CALL OPEN(err,ErrorFile,W)
- CALL WRITELN(err,'"'Path'"')
- RETURN
- END
-
- Playaddress = READCH(f,6)
- Tunes = C2D(READCH(f,2))
- StartTune = C2D(READCH(f,2))
- Speed = READCH(f,4)
- Name = STRIP(READCH(f,32),B,NULL)
- Author = STRIP(READCH(f,32),B,NULL)
- Copyright = STRIP(READCH(f,30),B,NULL)
- CALL CLOSE(f)
-
- /* Modify this line if you want to change the output */
- DBaseLine = '"'Name'","'Author'","'Copyright'","'Tunes'","'Path'"'
-
- IF StartTune > 1 THEN DO
- /* If you have modified the "DBaseLine" above, */
- /* you MUST modify this line aswell, so they look alike. */
- /* You may NOT separate "'Songs','SongStart'" from each other */
- DBaseLine = '"'Name'","'Author'","'Copyright'","'Tunes','StartTune'","'Path'"'
- END
-
- CALL WRITELN(d,DBaseLine)
- count = count + 1
- RETURN
-
- AddRexxSupport:
- SIGNAL ON SYNTAX
- IF ~SHOW('l','rexxsupport.library') THEN
- CALL ADDLIB('rexxsupport.library',0,-30)
- CALL NULL()
- RETURN 1
- Syntax:
- IF ARG(1)='FAIL' THEN DO
- ECHO "Library rexxsupport.library is unavailable."
- EXIT
- END
- ELSE
- SIGNAL OFF SYNTAX
- RETURN 0
-
- CheckArgs:
- out_name = STRIP(out_name,B,' "')
- in_name = STRIP(in_name,B,' "')
-
- IF in_name = '' | in_name = '?' | in_name = '-?' THEN DO
- ECHO Usage
- CALL CleanUp
- EXIT
- END
-
- IF ~EXISTS(in_name) THEN DO
- ECHO BELL'Unable to locate "'in_name'".'CR||CR||Usage
- CALL CleanUp
- EXIT 20
- END
-
- IF ~OPEN(d,out_name,W) THEN DO
- ECHO BELL'Unable to open destination file "'out_name'".'CR||CR||Usage
- CALL CleanUp
- EXIT 20
- END
- RETURN
-
- ScanDir:
- ECHO '* Scanning:'EMPTY||BOLD in_name OFF||CR
- ADDRESS COMMAND 'LIST FILES ALL "'in_name'" TO' TempFiles 'LFORMAT "%f%n"'
- CALL OPEN(s,TempFiles,R)
- DO UNTIL EOF(s)
- IF READLN(s) = '' THEN DO
- ITERATE
- END
- countfiles = countfiles + 1
- END
- CALL CLOSE(s)
- CALL DoFiles
- RETURN
-
- PrintErrors:
- CALL CLOSE(err)
- IF ~OPEN(err,ErrorFile,R) THEN DO
- ECHO CR'No errors!'
- RETURN
- END
-
- ECHO CR'Errors:'CR
- DO UNTIL EOF(err)
- error = READLN(err)
- IF error = '' THEN DO
- ITERATE
- END
- ECHO 'File:'BOLD error OFF||CR||'- is not a PlaySID One-Part file!'CR
- END
- RETURN
-
- InitVar:
- NULL = "00"X
- CR = "0a"X
- BELL = "07"X
- UP = "0b"X
- ESC = "9b"X
- BOLD = ESC"1m"
- OFF = ESC"0m"
- CursorOFF = ESC'302070'X
- CursorON = ESC'2070'X
- EMPTY = ESC'J'
- countfiles = 0
- count = 0
- cperc = 0
- Usage = 'Usage: SIDList <dir|file> TO <outfile>'
- Version = 'V2.0'
- Copyright = 'Copyright ©1994 Ulf Diabelez Harries'
- note = 'SIDList' Version
- info = 'Extracts Song-Info from PlaySID One-Part files'
- ErrorFile = 'T:SIDList.errors'
- TempFiles = 'T:SIDList.files'
- RETURN
-
- PrintTitle:
- ECHO CursorOFF||CR||BOLD||note||CR||Copyright||CR||info||CR||OFF
- RETURN
-
- BREAK_C:;BREAK_D:;BREAK_E:;BREAK_F:;HALT:
- ECHO BELL||CR'**BREAK!'
- CALL CleanUp
- EXIT 5
- RETURN
-
- IOERR:
- ECHO BELL||BELL||BELL||CR'**I/O Error!'
- CALL CleanUp
- EXIT 20
- RETURN
-
- CleanUp:
- CALL CLOSE(err)
- CALL CLOSE(c)
- CALL CLOSE(d)
- CALL CLOSE(t)
- CALL DELETE(ErrorFile)
- CALL DELETE(TempFiles)
- ECHO CursorON
- RETURN
-
- PrintInfo:
- ECHO UP||UP'Finished!'EMPTY||CR||'Done:'BOLD 100||OFF'%'EMPTY||CR||CR||'Files processed:' BOLD||countfiles||OFF||CR||'PlaySID files: ' BOLD||count||OFF
- RETURN
-