about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/dtas/tracklist.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb
index 68e88f2..6e0dd75 100644
--- a/lib/dtas/tracklist.rb
+++ b/lib/dtas/tracklist.rb
@@ -123,10 +123,11 @@ class DTAS::Tracklist # :nodoc:
     @goto_pos = @goto_off = nil
     if cur[next_pos]
       @pos = next_pos
-    elsif repeat
-      next_pos = @pos = 0
     else
-      return
+      # reshuffle the tracklist when we've exhausted it
+      cur.shuffle! if @shuffle
+      return unless repeat
+      next_pos = @pos = 0
     end
     [ cur[next_pos].to_path, next_off ]
   end