[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/5] dtas-console: avoid crashing on failed cue seeks
From: |
Eric Wong |
Subject: |
[PATCH 4/5] dtas-console: avoid crashing on failed cue seeks |
Date: |
Sat, 17 Jan 2015 11:49:21 +0000 |
Attempting to perform operations on a file which which cannot
handle it should not cause dtas-console to die with a backtrace
---
bin/dtas-console | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bin/dtas-console b/bin/dtas-console
index ee0c126..2ed2f0b 100755
--- a/bin/dtas-console
+++ b/bin/dtas-console
@@ -104,6 +104,10 @@ def rg_string(rg, current)
rv
end
+def may_fail(res, events)
+ events << res if res != "OK"
+end
+
enc_locale = Encoding.find("locale")
$stdout.set_encoding(enc_locale)
enc_opts = { undef: :replace, invalid: :replace, replace: '?' }
@@ -202,8 +206,8 @@ begin
when "f" then c.req_ok("rg fallback_gain-=1")
when ">" then c.req_ok("tl next")
when "<" then c.req_ok("tl prev")
- when "!" then c.req_ok("cue prev")
- when "@" then c.req_ok("cue next")
+ when "!" then may_fail(c.req("cue prev"), events)
+ when "@" then may_fail(c.req("cue next"), events)
when " "
c.req("play_pause")
when "r" # cycle through replaygain modes
--
EW