about summary refs log tree commit homepage
path: root/lib/dtas/player
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-05 22:20:00 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-05 22:20:00 +0000
commit1b680f0b124c0fe7b2aae48543643090c967ad44 (patch)
tree97091457c7bbed7c4ad7daa94529e75e14e4de93 /lib/dtas/player
parent253b910f920d1916ca44f2617221fd54ad219821 (diff)
downloaddtas-1b680f0b124c0fe7b2aae48543643090c967ad44.tar.gz
The addition of a "need_to_queue" method should reduce the amount of
cognitive overhead required to parse these conditions
Diffstat (limited to 'lib/dtas/player')
-rw-r--r--lib/dtas/player/client_handler.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index 5c6653c..75e490d 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -552,7 +552,7 @@ module DTAS::Player::ClientHandler # :nodoc:
       _tl_skip if set_as_current
 
       # start playing if we're the only track
-      if @tl.size == 1 && !(@current || @queue[0] || @paused)
+      if @tl.size == 1 && ! need_to_queue
         next_source(_next)
       end
       io.emit("#{track_id}")
@@ -589,9 +589,7 @@ module DTAS::Player::ClientHandler # :nodoc:
       offset = msg.shift # may be nil
       if @tl.go_to(track_id.to_i, offset)
         _tl_skip
-        if !(@current || @queue[0] || @paused)
-          next_source(_next)
-        end
+        next_source(_next) unless need_to_queue
         io.emit("OK")
       else
         io.emit("MISSING")