Skip to content

Instantly share code, notes, and snippets.

@JiriChara
Created January 21, 2013 20:48
Show Gist options
  • Save JiriChara/4589209 to your computer and use it in GitHub Desktop.
Save JiriChara/4589209 to your computer and use it in GitHub Desktop.
require 'eventmachine'
module Mplayer
def receive_data(data)
end
end
class Player
def initialize
@io = EM.popen("mplayer -noconsolecontrols -nolirc -idle -slave", Mplayer)
end
def play(track)
@io.send_data("loadfile \"#{track}\" 0\n")
end
end
EM.run do
Player.new.play("/path/to/some/song.mp3")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment