diff options
author | Eric Wong <e@80x24.org> | 2015-01-17 05:25:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-01-19 09:56:52 +0000 |
commit | 8f07678251b20f41063cd0a8fbf81f3b4bd39967 (patch) | |
tree | 3784018cd80f0e81c770a700ce4e615cd765a9d5 | |
parent | 657f2f9cf7785124bf18246ba326869e6acfb660 (diff) | |
download | dtas-8f07678251b20f41063cd0a8fbf81f3b4bd39967.tar.gz |
Attempting to perform operations on a file which which cannot handle it should not cause dtas-console to die with a backtrace
-rwxr-xr-x | bin/dtas-console | 8 |
1 files 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 |