[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/7] tracklist: previous! only wraps around when repeat is enable
From: |
Eric Wong |
Subject: |
[PATCH 6/7] tracklist: previous! only wraps around when repeat is enabled |
Date: |
Mon, 9 Sep 2013 08:31:08 +0000 |
Non-repeating tracklists should stop playing when there's nothing
to go back to.
---
lib/dtas/tracklist.rb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb
index 094c22d..644c57f 100644
--- a/lib/dtas/tracklist.rb
+++ b/lib/dtas/tracklist.rb
@@ -120,6 +120,10 @@ class DTAS::Tracklist
def previous!
return if @list.empty?
prev_idx = @pos - 1
- @goto_pos = @list[prev_idx] ? prev_idx : nil
+ if prev_idx < 0
+ # stop playback if nothing to go back to.
+ prev_idx = @repeat ? @list.size - 1 : @list.size
+ end
+ @goto_pos = prev_idx
end
end
--
1.8.4
- [PATCH 1/7] dtas-console: avoid using current if it is nil, Eric Wong, 2013/09/09
- [PATCH 3/7] tracklist: next_track -> advance_track, Eric Wong, 2013/09/09
- [PATCH 5/7] player: "tl goto" takes optional offset arg in HHMMSS.SUBSEC, Eric Wong, 2013/09/09
- [PATCH 7/7] tracklist: implement single-track repeat, Eric Wong, 2013/09/09
- [PATCH 2/7] player: reset tracklist when idle stat is detected, Eric Wong, 2013/09/09
- [PATCH 6/7] tracklist: previous! only wraps around when repeat is enabled,
Eric Wong <=
- [PATCH 4/7] player: implement previous/next commands, Eric Wong, 2013/09/09