Jump to content

making this faster??


Rhys

Recommended Posts

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

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 by The Gate Keeper
Link to comment
Share on other sites

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 by tidy trax
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...