Introduction
Introduction Statistics Contact Development Disclaimer Help
Better error handling, no use of /data directory - warvox - VoIP based wardiali…
Log
Files
Refs
README
---
commit 14dda8a60d3172d24799205e1c6a0dd44ae6e910
parent 360baecf533d8d85d9174b91ecef6c270526edf4
Author: HD Moore <[email protected]>
Date: Fri, 28 Dec 2012 11:14:41 -0600
Better error handling, no use of /data directory
Diffstat:
M lib/warvox/audio/raw.rb | 3 +++
M lib/warvox/jobs/analysis.rb | 2 +-
M lib/warvox/jobs/dialer.rb | 10 +++++-----
3 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/lib/warvox/audio/raw.rb b/lib/warvox/audio/raw.rb
@@ -189,6 +189,9 @@ class Raw
}.first
end
+ # Purge any empty fft slices
+ ffts.delete(nil)
+
# Map each slice of the audio's FFT with each FFT chunk (8k sa…
tops = ffts.map{|x| x.map{|y| y.map{|z|
diff --git a/lib/warvox/jobs/analysis.rb b/lib/warvox/jobs/analysis.rb
@@ -114,7 +114,7 @@ class Analysis < Base
end
pfd = IO.popen("#{bin} '#{tmp.path}'")
- out = Marshal.load(pfd.read)
+ out = Marshal.load(pfd.read) rescue nil
pfd.close
return if not out
diff --git a/lib/warvox/jobs/dialer.rb b/lib/warvox/jobs/dialer.rb
@@ -90,9 +90,6 @@ class Dialer < Base
end
def start_dialing
- dest = File.join(WarVOX::Config.data_path, @name.to_s)
- FileUtils.mkdir_p(dest)
-
# Scrub all numbers matching the blacklist
list = WarVOX::Config.blacklist_load
list.each do |b|
@@ -124,7 +121,8 @@ class Dialer < Base
Thread.current.kill if not num
Thread.current.kill if not prov
- out = File.join(dest, num+".raw")
+ out_fd = Tempfile.new("rawfile")
+ out = out_fd.path
begin
# Execute and read the output
@@ -182,9 +180,11 @@ class Dialer < Base
File.open(out, "rb") do |fd|
res.audio = fd.read(fd…
end
- File.unlink(out)
end
+ out_fd.close
+ ::FileUtils.rm_f(out)
+
@calls << res
rescue ::Exception => e
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.