about summary refs log tree commit homepage
path: root/lib/dtas/player/client_handler.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-07 02:34:28 +0000
committerEric Wong <e@80x24.org>2015-12-14 02:04:44 +0000
commit6c8504238ddbd96deea577df58c043b95cb1068d (patch)
tree3ddcebc0f388d6935b3d4df4dda23851a41aa73d /lib/dtas/player/client_handler.rb
parent71cc32bcac667c699b89ef5f0b5147cf1b3670a5 (diff)
downloaddtas-6c8504238ddbd96deea577df58c043b95cb1068d.tar.gz
This (from the point of the client) will atomically swap
two tracks.  This should allow easily implementing of a
tracklist editor.
Diffstat (limited to 'lib/dtas/player/client_handler.rb')
-rw-r--r--lib/dtas/player/client_handler.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index e0af295..17cd6c3 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -696,6 +696,14 @@ module DTAS::Player::ClientHandler # :nodoc:
     io.emit('OK')
   end
 
+  def _dpc_tl_swap(io, msg)
+    usage = 'ERR usage: "tl swap TRACK_ID_A TRACK_ID_B"'
+    a_id = msg.shift or return io.emit(usage)
+    b_id = msg.shift or return io.emit(usage)
+    @tl.swap(a_id.to_i, b_id.to_i) or return io.emit('MISSING')
+    io.emit('OK')
+  end
+
   def __bp_prev_next(io, msg, cur, bp)
     case type = msg[1]
     when nil, "track"