everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
* [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 related	[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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/dtas.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).