Skip to content

Instantly share code, notes, and snippets.

@floere
Created September 12, 2012 18:36
Show Gist options
  • Select an option

  • Save floere/3708935 to your computer and use it in GitHub Desktop.

Select an option

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
@tonini

tonini commented Sep 12, 2012

Copy link
Copy Markdown

woooot! ;)

@floere

floere commented Sep 12, 2012

Copy link
Copy Markdown
Author

:)
Add a .cycle after the shuffle, if you want it to loop forever.

@niko

niko commented Sep 12, 2012

Copy link
Copy Markdown

What happened to good old mpg123? :)

@floere

floere commented Sep 12, 2012

Copy link
Copy Markdown
Author

It won't support Picky in the future ;)

@andykitchen

Copy link
Copy Markdown

I've been using BashTunes:

find . -name *.mp3 | xargs afplay

@floere

floere commented Sep 23, 2012

Copy link
Copy Markdown
Author

I like it!

@rogerbraun

Copy link
Copy Markdown

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