Locate and play mp3 files with given pattern in path


/ Published in: Ruby
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.