Posted By

Adek336 on 06/13/07


database library mp3 locate

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Locate and play mp3 files with given pattern in path

 / Published in: Ruby

Gets an mp3 player to play mp3s which contain all the phrases given as arguments. Locate is much faster than xmms' library, usually in split a second. This is very handy, when you install a command-line into the wm panel. Creates files /locate.0, /locate.1, /locate.tmp.m3u. Not reentrant.

  1. system('locate -i '+ARGV[0]+' >/locate.0');
  2. iter=""
  3. no=0
  4. ARGV.each {
  5. |iter|
  6. system('grep -i </locate.'+no.to_s+' '+iter+' >/locate.'+(1-no).to_s);
  7. no=1-no
  8. }
  9. system('grep </locate.'+no.to_s+' .mp3$ >/locate.tmp.m3u');
  10. # system('dcop amarok playlist addMedia /locate.tmp.m3u');
  11. system('xmms /locate.tmp.m3u');

Report this snippet  

You need to login to post a comment.