* [PATCH] source/splitfx: fail gracefully on missing files
@ 2014-12-29 12:21 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2014-12-29 12:21 UTC (permalink / raw)
To: dtas-all
We cannot afford to break the entire player because somebody
enqueued a non-existent file (or enqueued and later renamed it).
---
lib/dtas/source/splitfx.rb | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/dtas/source/splitfx.rb b/lib/dtas/source/splitfx.rb
index 2b10e5c..5340f3d 100644
--- a/lib/dtas/source/splitfx.rb
+++ b/lib/dtas/source/splitfx.rb
@@ -33,23 +33,22 @@ class DTAS::Source::SplitFX < DTAS::Source::Sox # :nodoc:
end
sfx = DTAS::SplitFX.new
- begin
- Dir.chdir(File.dirname(ymlfile)) do # ugh
- @ymlhash = YAML.load(buf)
- @ymlhash['tracks'] ||= [ "t 0 default" ]
- sfx.import(@ymlhash)
- sfx.infile.replace(File.expand_path(sfx.infile))
- end
- @splitfx = sfx
- rescue
- return false
+ Dir.chdir(File.dirname(ymlfile)) do # ugh
+ @ymlhash = YAML.load(buf)
+ @ymlhash['tracks'] ||= [ "t 0 default" ]
+ sfx.import(@ymlhash)
+ sfx.infile.replace(File.expand_path(sfx.infile))
end
+ @splitfx = sfx
@infile = ymlfile
sox = @sox.try(sfx.infile, offset) or return false
rv = source_file_dup(ymlfile, offset)
rv.sox = sox
rv.env = sfx.env
rv
+ rescue => e
+ warn "#{e.message} (#{e.class})"
+ false
end
def __load_comments
--
EW
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-29 12:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-29 12:21 [PATCH] source/splitfx: fail gracefully on missing files Eric Wong
everything related to duct tape audio suite (dtas)
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://80x24.org/dtas-all
git clone --mirror http://ou63pmih66umazou.onion/dtas-all
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V1 dtas-all dtas-all/ https://80x24.org/dtas-all \
dtas-all@nongnu.org
public-inbox-index dtas-all
Example config snippet for mirrors.
Newsgroups are available over NNTP:
nntp://news.public-inbox.org/inbox.comp.audio.dtas
nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas
note: .onion URLs require Tor: https://www.torproject.org/
code repositories for the project(s) associated with this inbox:
../../../dtas.git
AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git