Rhys Posted January 6, 2006 Report Share Posted January 6, 2006 is there a way to make this alias faster? it's getting on my nerves now, when i open my mp3 player, it takes like a minute because mirc freezes. alias loadsongs { var %i = 1 while (%i <= $lines(mp3s.txt)) { did -a mp3 1 $replace($duration($calc($mp3($read(mp3s.txt,%i)).length / 1000)),mins,m,secs,s,min,m,sec,s) $chr(9) $remove($nopath($read(mp3s.txt,%i)),.mp3) inc %i } } thanks Link to comment Share on other sites More sharing options...
Angelia Posted January 6, 2006 Report Share Posted January 6, 2006 apparently the best way to do it is use a huge amount of hash tables on startup and load the actual list into a db file but i dont know the technicalities of it, sorry Link to comment Share on other sites More sharing options...
The Gate Keeper Posted January 6, 2006 Report Share Posted January 6, 2006 (edited) alias loadsongs { var %l = 1 , %i window -h @mp3 if ($exists(mp3s.txt)) loadbuf $lines(mp3s.txt) @mp3 mp3s.txt while ($line(@mp3,%l)) { %i = $ifmatch did -a mp3 1 $replace($duration($calc($mp3(%i).length / 1000)),mins,m,secs,s,min,m,sec,s) $chr(9) $remove($nopath(%i),.mp3) inc %l } window -c @mp3 } You could try this. Edited January 7, 2006 by The Gate Keeper Link to comment Share on other sites More sharing options...
Rhys Posted January 6, 2006 Author Report Share Posted January 6, 2006 that doesen't put the songs into my dialog. Link to comment Share on other sites More sharing options...
The Gate Keeper Posted January 7, 2006 Report Share Posted January 7, 2006 i had a bracket mismatch, try it again. Link to comment Share on other sites More sharing options...
tidy trax Posted January 7, 2006 Report Share Posted January 7, 2006 (edited) I'd actually go for the /filter method: alias loadsongs { if ($isfile(mp3s.txt)) filter -fk mp3s.txt addtodialog } alias addtodialog did -a mp3 1 $replace($duration($calc($mp3($1-).length /1000)),mins,m,secs,s,min,m,sec,s) $chr(9) $gettok($nopath(%i),-1,46) Edited January 7, 2006 by tidy trax Link to comment Share on other sites More sharing options...
The Gate Keeper Posted January 7, 2006 Report Share Posted January 7, 2006 the master is back. Link to comment Share on other sites More sharing options...
hixxy Posted January 7, 2006 Report Share Posted January 7, 2006 apparently the best way to do it is use a huge amount of hash tables on startup and load the actual list into a db file but i dont know the technicalities of it, sorry Ugh I've got no idea where you read that but that is definitely not the best way to do it. Link to comment Share on other sites More sharing options...
The Gate Keeper Posted January 7, 2006 Report Share Posted January 7, 2006 arr, if used correctly it can be a lot faster than doing it from a text file. Link to comment Share on other sites More sharing options...
hixxy Posted January 7, 2006 Report Share Posted January 7, 2006 arr, if used correctly it can be a lot faster than doing it from a text file. Using one or a few hashtables will be quicker than a file, using a huge amount, however, will not. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now