about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-31 02:37:55 +0000
committerEric Wong <e@80x24.org>2015-12-31 02:37:55 +0000
commit1caccb72485e06a17cae6cf2c03c54d434d32949 (patch)
tree85051dbad356c288c361cbc85fe0a2c729def8b0 /lib
parenta86268bfee552912d1e460989581f3634d39a824 (diff)
downloaddtas-1caccb72485e06a17cae6cf2c03c54d434d32949.tar.gz
It probably makes sense for the -console user to know if tracklist
repeat and trim are enabled.  Have player emit these in "current"
output and let the console client track them for now.
Diffstat (limited to 'lib')
-rw-r--r--lib/dtas/player/client_handler.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index 6167fcb..617a20c 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -302,6 +302,7 @@ module DTAS::Player::ClientHandler # :nodoc:
     tmp["current_inflight"] = @sink_buf.inflight
     tmp["format"] = @format.to_hash.delete_if { |_,v| v.nil? }
     tmp["bypass"] = @bypass.sort!
+    t = @trim and tmp['trim'] = t.join(' ')
     if tmp['paused'] = @paused
       first = @queue[0] and tmp['current_paused'] = first
     end
@@ -602,12 +603,15 @@ module DTAS::Player::ClientHandler # :nodoc:
 
   def _dpc_tl_repeat(io, msg)
     prev = @tl.repeat.to_s
+    do_wall = true
     case msg.shift
     when 'true' then @tl.repeat = true
     when 'false' then @tl.repeat = false
     when '1' then @tl.repeat = 1
     when nil
+      do_wall = false
     end
+    __wall("tl repeat #{@tl.repeat}") if do_wall
     io.emit("tl repeat #{prev}")
   end
 
@@ -793,7 +797,9 @@ module DTAS::Player::ClientHandler # :nodoc:
     else
       return io.emit('ERR usage: trim [off|TBEG [TLEN]]')
     end
-    io.emit(t ? t.map(&:to_s).join(' ') : 'off')
+    t = t ? t.map(&:to_s).join(' ') : 'off'
+    __wall("trim #{t}")
+    io.emit(t)
   end
 end
 # :startdoc: