Advertisement
Shiny_

Untitled

Dec 17th, 2014
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.74 KB | None | 0 0
  1. class Player
  2.   def liquidsoap
  3.     pid = fork do
  4.       Signal.trap("HUP") { exit }
  5.       Process.spawn "cd ~/Pulpit; liquidsoap serwer.liq"
  6.     end
  7.     Process.kill("HUP", pid)
  8.     Process.wait
  9.   end
  10.   def mplayer
  11.     pid_2 = fork do
  12.       Signal.trap("HUP") { exit }
  13.       Process.spawn "mplayer http://127.0.0.1:8000/stream.ogg"
  14.     end
  15.     Process.kill("HUP", pid_2)
  16.     Process.wait
  17.   end
  18.   def pavucontrol
  19.     pid_3 = fork do
  20.       Signal.trap("HUP") { exit }
  21.       Process.spawn "pavucontrol"
  22.     end
  23.     Process.kill("HUP", pid_3)
  24.     Process.wait
  25.   end
  26. end
  27.  
  28. run = Player.new
  29. run.liquidsoap
  30. run.mplayer
  31. run.pavucontrol
  32.  
  33. at_exit {
  34.   exec("killall liquidsoap; killall mplayer; killall pavucontrol")
  35.   puts "Zdechły"
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement