|
Joined: Dec 2002
Posts: 204
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 204 |
hi yall, i am having a little problem with $findfile and /hadd. The code below has two sections, the first part, in green , works and has no problems other than being a little slow, but the second part, in red, totally freezes up mirc, and makes it stop responding, no matter how long i wait. the first part, writes the files to a custom window and then adds the files to a hash table, and the second part is SUPPOSED to add the files straight into a hash table with hadd and $findfile in a while loop. [color:green]Menu channel,status {
Update Hash List:{
window -esn @files
echo -a 11,2Processing File List, Please Wait...................
echo -a 11,2Adding $findfile($mp3dir,*.mp3,0,aline @files $1- ) files, I am doing further processing now.
savebuf @files neorawfiles.txt
window -c @files
var %songno $lines(neorawfiles.txt)
while %songno > 0 {
hadd -m filelist file $+ %songno $read(neorawfiles.txt,%songno)
dec %songno
}
echo -a 11,2Finished adding4,2 $lines(neorawfiles.txt) 11,2files to the filelist hash table
}
[color:red] Test update hash list - WARNING:{
if ($hget(filelist) != filelist) {
hmake filelist 1000
var %thmp = $findfile($mp3dir,*.mp3,0)
while %thmp > 0 {
.hadd filelist file $+ %thmp $findfile($mp3dir,*.mp3,%thmp)
dec %thmp
}
}
elseif ($hget(filelist) == filelist) {
hfree filelist
hmake filelist 1000
var %thmp = $findfile($mp3dir,*.mp3,0)
while %thmp > 0 {
.hadd filelist file $+ %thmp $findfile($mp3dir,*.mp3,%thmp)
dec %thmp
}
}
}
} [/color][/color] Like I said, it keeps locking mirc up so that it doesnt respond. can y all look over the code, and see what i am doing wrong, or tell me IF hadd and findfile can be used in a while loop like this?
keek: Scots - intr.v. keeked, keekĀ·ing, keeks To peek; peep.
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Menu channel,status {
Update Hash List:{
window -esn @files
echo -a 11,2Processing File List, Please Wait...................
echo -a 11,2Adding $findfile($mp3dir,*.mp3,0,aline @files $1- ) files, I am doing further processing now.
savebuf @files neorawfiles.txt
window -c @files
var %songno $lines(neorawfiles.txt)
while %songno > 0 {
hadd -m filelist file $+ %songno $read(neorawfiles.txt,%songno)
dec %songno
}
echo -a 11,2Finished adding4,2 $lines(neorawfiles.txt) 11,2files to the filelist hash table
}
[color:red]Test update hash list:{
if $hget(filelist) { hfree filelist }
hmake filelist 1000
.!echo -q $findfile($mp3dir,*.mp3,0,hadd filelist $+(file,$calc($hget(filelist,0).item +1)) $1-)
}
}[/color]
|
|
|
|
Joined: Dec 2002
Posts: 204
Fjord artisan
|
OP
Fjord artisan
Joined: Dec 2002
Posts: 204 |
thanks nimue, that makes my list go a heck of a lot faster
keek: Scots - intr.v. keeked, keekĀ·ing, keeks To peek; peep.
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Yep, adding commands into $findfile() is far quicker than looping through results manually.
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 332 |
if i may ask ? what is the purpose of the Hash Table ? i'm not criticizing the script by any means just not quite sure what the purpose is
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
Perhaps you might ask keeker that
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 332 |
if i may ask ? what is the purpose of the Hash Table ? i'm not criticizing the script by any means just not quite sure what the purpose is specifically of the Hash Table thx
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 332 |
ic sorry i didnt think which reply you clicked on was specific ? i thought it just replied to the post in general
|
|
|
|
|