Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'open3'
- Open3.popen2('pianobar', 'r+') do |stdin, stdout|
- out = ''
- loop do
- o, i, _ = IO.select([stdout], [stdin], nil, 0.1)
- unless o.first.nil?
- out += o.first.readpartial(8000)
- end
- case out
- when /\n$/
- print out
- out.clear
- when /Username:\ /
- print out
- out.clear
- i.first.write "bluepojo+pandora@gmail.com\n"
- when /Password:\ /
- print out
- out.clear
- i.first.write "supersecret\n"
- when /Select station:\ /
- print out
- out.clear
- i.first.write "#{gets}\n"
- end
- end
- end
Add Comment
Please, Sign In to add comment