about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-09 06:49:57 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-09 06:50:12 +0000
commit87b0316f2bad10ce2f8caa1a60065ab9f3592bbf (patch)
tree1f04914716c1c233997c72e4507bcbaccf83b22e /lib
parent0eec3250509c290d7be0cec43b06cb621f2b71f8 (diff)
downloaddtas-87b0316f2bad10ce2f8caa1a60065ab9f3592bbf.tar.gz
A paused/seeked track in the tracklist may end up in the queue.
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 f313a2a..b9beee4 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -580,7 +580,13 @@ module DTAS::Player::ClientHandler # :nodoc:
         _tl_skip
       end
 
-      io.emit(@tl.remove_track(track_id) ? "OK" : "MISSING")
+      if @tl.remove_track(track_id)
+        # drop it from the queue, too, in case it just got requeued or paused
+        @queue.delete_if { |t| Array === t && t[0].object_id == track_id }
+        io.emit("OK")
+      else
+        io.emit("MISSING")
+      end
     when "get"
       res = @tl.get_tracks(msg.map! { |i| i.to_i })
       res.map! { |tid, file| "#{tid}=#{file ? Shellwords.escape(file) : ''}" }