|
Joined: Jan 2005
Posts: 75
Babel fish
|
OP
Babel fish
Joined: Jan 2005
Posts: 75 |
I need this to list faster, i just freezes mIRC for ages, i think somehow i need it to write the tracks to a text file then list them, meanwhile this is what i have alias mplist {
var %len $calc($len(%mp3.dir) + 1)
did -r mp 4
did -r mp 35
did -a mp 35 0 of $findfile(%mp3.dir,*.mp3,0, did -a mp 4 $remove($mid($1-,%len),.mp3))
did -o mp 36 1 $mpsize
} it's just so slow
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
You should always store large amounts of files you need to use in a single file/hashtable/whatever. If you have a lot of mp3s then a hashtable would be best, repeatedly accessing a single file can be slow as well, especially with $read instead of file handling commands. * tidy_trax thinks a $findfilecall() (Like $dllcall() and $comcall() - multi-threaded) would be nice.
New username: hixxy
|
|
|
|
Joined: Jan 2005
Posts: 75
Babel fish
|
OP
Babel fish
Joined: Jan 2005
Posts: 75 |
It's strange, i just tried it on a blank mIRC 6.12, and it listed 3000 tracks in less than 5 seconds, mIRC 6.16 took a minute and a half, something drastic has changed
|
|
|
|
Joined: Jan 2005
Posts: 75
Babel fish
|
OP
Babel fish
Joined: Jan 2005
Posts: 75 |
i've found the problem, it's not the listing, it's the the alias that's getting the size of the folder that is slowing it down. alias mpsize {
%mp3size = 0
var %temp $findfile(%mp3.dir,*.mp3,0,inc %mp3size $file($1-).size))
return $round($calc(%mp3size / 1073741824),2) $+ gb
}
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
alias mplist {
set -u %len $calc($len(%mp3.dir) + 1)
did -r mp 4
did -r mp 35
set -u %mp3size 0
did -a mp 35 0 of $findfile(%mp3.dir,*.mp3,0, mpfile $1- )
did -o mp 36 1 $round($calc(%mp3size / 1073741824),2) $+ gb
}
alias mpfile {
did -a mp 4 $remove($mid($1-,%len),.mp3)
inc %mp3size $file($1-).size)
}
Do both the jobs in one pass. This might help somewhat.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, you could try this snippet, it gives my foldersize pretty instantly, no matter how many files, folder with 3500 files like my program files. Usage: $foldersize(path to folder [,bkmgt3]) Path to folder does not have to contain quotes " ", does not have to contain a trailing slash, but can, and a second parameter is optional to show the unit of the format that you chose of the $bytes identifier. The default output is in bytes. The output includes all the subfolders, and is actually the same function as when you right click in Explorer to see the size, being the filesystem object from windows. Examples: //echo -a $foldersize(c:\program files) //echo -a $foldersize($mircdir,m) alias foldersize {
if !$exists($$1\) { echo -ac info $!foldersize: No such folder $1 | return }
var %a = a $+ $ticks, %b = b $+ %a, %c = $2
.comopen %a Scripting.FileSystemObject
if !$comerr {
.comclose %a $com(%a,GetFolder,1,bstr,$remove($1\,"),dispatch* %b)
if $com(%b) {
tokenize 32 $com(%b,Size,3) $com(%b).result
.comclose %b
return $iif(%c,$bytes($2,%c).suf,$2)
}
}
}
Gone.
|
|
|
|
Joined: Jan 2005
Posts: 75
Babel fish
|
OP
Babel fish
Joined: Jan 2005
Posts: 75 |
Now that is perfect, thanks!!
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Glad I could be of help
Gone.
|
|
|
|
|