[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/7] player: reset tracklist when idle stat is detected
From: |
Eric Wong |
Subject: |
[PATCH 2/7] player: reset tracklist when idle stat is detected |
Date: |
Mon, 9 Sep 2013 08:31:04 +0000 |
We should return to the starting position of the tracklist if we
are idle.
---
lib/dtas/player.rb | 9 +++++++--
lib/dtas/tracklist.rb | 5 +++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb
index a8c7fe0..8926e0b 100644
--- a/lib/dtas/player.rb
+++ b/lib/dtas/player.rb
@@ -359,7 +359,7 @@ class DTAS::Player # :nodoc:
end
end
- echo "idle"
+ player_idle
nil
end
@@ -388,10 +388,15 @@ class DTAS::Player # :nodoc:
@srv.wait_ctl(dst, :wait_readable)
else
stop_sinks if @sink_buf.inflight == 0
- echo "idle"
+ player_idle
end
end
+ def player_idle
+ @tl.reset
+ echo "idle"
+ end
+
def drop_target(target)
@srv.wait_ctl(target, :delete)
target.close
diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb
index 01339cc..a51db32 100644
--- a/lib/dtas/tracklist.rb
+++ b/lib/dtas/tracklist.rb
@@ -35,6 +35,11 @@ class DTAS::Tracklist
@goto_pos = nil
end
+ def reset
+ @goto_pos = nil
+ @pos = TL_DEFAULTS["pos"]
+ end
+
def size
@list.size
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 <=
- [PATCH 6/7] tracklist: previous! only wraps around when repeat is enabled, Eric Wong, 2013/09/09
- [PATCH 4/7] player: implement previous/next commands, Eric Wong, 2013/09/09