home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** CalcDl.thor 1.0 (19.5.95) Eirik Synnes ** ** This script will calculate an estimate of the time needed to download ** files selected in Thor and present the results in a requester. In ** order to do this the files will have to be present in Thor's file ** database. It can be run either in the Startup Window or from inside a ** system. ** ** Change the cpsrate variable below to whatever your modem is capable of. ** Suggested values are 3100 for 28.8k modems and 1500 for 14.4k modems. ** (a bit lower than the maximum rate to justify for poor phonelines and ** delays) ** ** Please note that this won't work with files selected for ftp'ing with ** FTPGet.thor since these files are not added as events. ** */ cpsrate = 3100 options results /* Find Thor and BBSREAD ARexx ports' */ p=address()||' '||show('P',,);if pos('THOR.',p)>0 then thorport=word(substr(p,pos('THOR.',p)),1);else do;say 'No THOR port found!';exit(0);end if ~show('p', 'BBSREAD') then do; address command; "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"; "WaitForPort BBSREAD"; end totsize = 0; numfiles = 0; notfound = 0 address(thorport) CURRENTSYSTEM STEM curbbs if rc > 1 then do REQUESTNOTIFY '"'THOR.LASTERROR'"' '"Ok"' exit(0) end address(bbsread) GETBBSDATA BBSNAME '"'curbbs.BBSNAME'"' STEM bbsdata if rc ~= 0 then do REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Ok"' exit(0) end if bbsdata.NUMEVENT > 0 then do event = bbsdata.FIRSTEVENT to bbsdata.LASTEVENT READBREVENT BBSNAME '"'curbbs.BBSNAME'"' EVENTNR event TAGSSTEM evtag DATASTEM evdata if rc ~= 0 then do REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Ok"' exit(0) end if evdata.EVENTTYPE = 4 then do if ~bittst(evdata.FLAGS, 0) & ~bittst(evdata.FLAGS, 2) & ~bittst(evdata.FLAGS, 3) & ~bittst(evdata.FLAGS, 5) then do if evtag.DIRECTORY = 'EVTAG.DIRECTORY' then SEARCHBRFILE BBSNAME '"'curbbs.BBSNAME'"' STEM file SEARCH '"'evtag.FILENAME'"' NAME else SEARCHBRFILE BBSNAME '"'curbbs.BBSNAME'"' STEM file FAREANAME '"'evtag.DIRECTORY'"' SEARCH '"'evtag.FILENAME'"' NAME if rc ~= 0 then do REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Ok"' exit(0) end if result > 0 then do READBRFILE BBSNAME '"'curbbs.BBSNAME'"' FAREANAME '"'file.FILEAREA.1'"' FILENR file.FILE.1.1 TAGSSTEM fltag if rc ~= 0 then do REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Ok"' notfound = notfound + 1 end else do totsize = totsize + fltag.SIZE numfiles = numfiles + 1 end end else notfound = notfound + 1 end end drop evtag. evdata. file. end address(thorport) if totsize = 0 & notfound = 0 then do REQUESTNOTIFY '"No active downloads on 'curbbs.BBSNAME'."' '"Ok"' exit(0) end if totsize > 0 then do xfertime = totsize / 8 * 9 / cpsrate xfermin = trunc(xfertime / 60) xfersec = trunc(xfertime // 60) reqbody = 'Statistics on active downloads at 'curbbs.BBSNAME':\n'numfiles 'files counting 'totsize' bytes ('totsize/1024'kb).\nApprox. 'xfermin' minute(s) and 'xfersec' second(s) transfertime.' if notfound > 0 then reqbody = reqbody'\n'notfound' file(s) were not found in the file database.' end else do if notfound > 0 then reqbody = 'None of the files were found in the file database.' end REQUESTNOTIFY '"'reqbody'"' '"Thanks"' exit(0)