Guest User

Untitled

a guest
Aug 28th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. require 'open3'
  2.  
  3. Open3.popen2('pianobar', 'r+') do |stdin, stdout|
  4. out = ''
  5. loop do
  6. o, i, _ = IO.select([stdout], [stdin], nil, 0.1)
  7. unless o.first.nil?
  8. out += o.first.readpartial(8000)
  9. end
  10. case out
  11. when /\n$/
  12. print out
  13. out.clear
  14. when /Username:\ /
  15. print out
  16. out.clear
  17. i.first.write "bluepojo+pandora@gmail.com\n"
  18. when /Password:\ /
  19. print out
  20. out.clear
  21. i.first.write "supersecret\n"
  22. when /Select station:\ /
  23. print out
  24. out.clear
  25. i.first.write "#{gets}\n"
  26. end
  27. end
  28. end
Add Comment
Please, Sign In to add comment