lib/mpg321.rb in mpg321-0.3.0 vs lib/mpg321.rb in mpg321-0.3.1

- old
+ new

@@ -4,17 +4,19 @@ class Mpg321 attr_reader :volume def initialize @volume = 50 + @paused = false @music_input, @stdout, @stderr, _thread = Open3.popen3("mpg321 -R mpg321_ruby") handle_stderr handle_stdout send_volume end def pause + @paused = !@paused @music_input.puts "P" end def stop @music_input.puts "S" @@ -70,10 +72,10 @@ #Not sure how to test this yet begin Timeout::timeout(1) { @stderr.readline } rescue Timeout::Error - play @song_list if @list + play @song_list if @list && !@paused end end end end