Skip to content

Instantly share code, notes, and snippets.

@floere
Created September 12, 2012 18:36
Show Gist options
  • Save floere/3708935 to your computer and use it in GitHub Desktop.
Save floere/3708935 to your computer and use it in GitHub Desktop.
A better iTunes
#!/usr/bin/env ruby
#
# Usage:
# p [pattern ...]
#
# Example:
# p E*.mp3 pop/A*.mp3
#
files = Dir[ARGV.shift || '*.mp3', *ARGV].shuffle
puts "Next song: Ctrl-C."
puts "Exit: Ctrl-C twice, quickly."
puts
interrupts = 0
Signal.trap('INT') do
exit if interrupts > 0
interrupts += 1
sleep 0.1
interrupts = 0
end
files.each do |file|
puts file
%x{afplay "#{file}"}
end
@floere
Copy link
Author

floere commented Sep 23, 2012

I like it!

@rogerbraun
Copy link

But does it really whip the llama's ass? If not, I'll stay with Winamp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment