URI: 
       Switch to marshal for interchange, use git postgres_ext - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit 6e553f120bad0e80842f90bf69dc9edcda1473f2
   DIR parent 52ae1909d535f2886e702c0a4d14dc497ae69c8b
  HTML Author: HD Moore <hd_moore@rapid7.com>
       Date:   Thu, 27 Dec 2012 01:14:43 -0600
       
       Switch to marshal for interchange, use git postgres_ext
       
       Diffstat:
         M Gemfile                             |       3 ++-
         M Gemfile.lock                        |      15 ++++++++++-----
         M app/models/dial_result.rb           |       1 -
         M app/views/analyze/view.html.erb     |       2 +-
         M bin/analyze_result.rb               |      15 ++++++++-------
         M config/initializers/warvox.rb       |       3 +++
         M lib/warvox/audio/raw.rb             |      15 +++++++++------
         M lib/warvox/jobs/analysis.rb         |      14 +++++---------
         M lib/warvox/jobs/dialer.rb           |       1 -
       
       9 files changed, 38 insertions(+), 31 deletions(-)
       ---
   DIR diff --git a/Gemfile b/Gemfile
       @@ -6,7 +6,8 @@ gem 'rails', '3.2.8'
        gem 'pg', '0.11'
        
        # Integer array support (until Rails 4.0 is released)
       -gem 'postgres_ext'
       +# Git version required to work around this bug: https://github.com/dockyard/postgres_ext/issues/5
       +gem 'postgres_ext', :git => 'git://github.com/dockyard/postgres_ext.git'
        
        gem 'kissfft'
        gem 'librex'
   DIR diff --git a/Gemfile.lock b/Gemfile.lock
       @@ -1,3 +1,11 @@
       +GIT
       +  remote: git://github.com/dockyard/postgres_ext.git
       +  revision: a0ac550ecc63f5413b31e808798443a7b7b250eb
       +  specs:
       +    postgres_ext (0.1.0)
       +      activerecord (~> 3.2.0)
       +      pg_array_parser (~> 0.0.8)
       +
        GEM
          remote: http://rubygems.org/
          specs:
       @@ -59,11 +67,8 @@ GEM
            mime-types (1.19)
            multi_json (1.5.0)
            pg (0.11.0)
       -    pg_array_parser (0.0.1)
       +    pg_array_parser (0.0.8)
            polyglot (0.3.3)
       -    postgres_ext (0.0.6)
       -      activerecord (~> 3.2.0)
       -      pg_array_parser (~> 0.0.1)
            rack (1.4.1)
            rack-cache (1.2)
              rack (>= 0.4)
       @@ -123,7 +128,7 @@ DEPENDENCIES
          kissfft
          librex
          pg (= 0.11)
       -  postgres_ext
       +  postgres_ext!
          rails (= 3.2.8)
          sass-rails (~> 3.2.3)
          thin
   DIR diff --git a/app/models/dial_result.rb b/app/models/dial_result.rb
       @@ -21,5 +21,4 @@ class DialResult < ActiveRecord::Base
                        "dial_results.id != \'#{id}\' " +
                        'ORDER BY matchscore DESC'
                }
       -
        end
   DIR diff --git a/app/views/analyze/view.html.erb b/app/views/analyze/view.html.erb
       @@ -50,7 +50,7 @@
                        %>
                                <div style="color: #<%= col%>;"><%=h name%> (<%=h sid %>@<%=h mat %>)</div>
                        <% end %>
       -                <% if dial_result.fprint and dial_result.fprint.to_s != '{}' %>
       +                <% if dial_result.fprint and dial_result.fprint.length > 0 %>
                                <a href="<%=view_matches_path(dial_result.id)%>">View Matches</a>
                        <% end %>
                </td>
   DIR diff --git a/bin/analyze_result.rb b/bin/analyze_result.rb
       @@ -3,14 +3,13 @@
        
        #
        # Load the library path
       -# 
       +#
        base = __FILE__
        while File.symlink?(base)
                base = File.expand_path(File.readlink(base), File.dirname(base))
        end
        $:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib'))
        require 'warvox'
       -require 'yaml'
        
        #
        # Script
       @@ -20,9 +19,11 @@ inp = ARGV.shift || exit(0)
        $0  = "warvox(analyzer): #{inp}"
        
        $stdout.write(
       -        WarVOX::Jobs::CallAnalysis.new(
       -                0
       -        ).analyze_call(
       -                inp
       -        ).to_yaml
       +        Marshal.dump(
       +                WarVOX::Jobs::CallAnalysis.new(
       +                        0
       +                ).analyze_call(
       +                        inp
       +                )
       +        )
        )
   DIR diff --git a/config/initializers/warvox.rb b/config/initializers/warvox.rb
       @@ -0,0 +1,3 @@
       +
       +# Extend PostgreSQL
       +require 'postgres_ext'
   DIR diff --git a/lib/warvox/audio/raw.rb b/lib/warvox/audio/raw.rb
       @@ -54,15 +54,15 @@ class Raw
                                (s > 0x7fff) ? (0x10000 - s) * -1 : s
                        end
                end
       -        
       +
                def to_raw
                        self.samples.pack("v*")
                end
       -        
       +
                def to_wav
                        raw = self.to_raw
       -                wav = 
       -                        "RIFF" + 
       +                wav =
       +                        "RIFF" +
                                        [raw.length + 36].pack("V") +
                                "WAVE" +
                                "fmt " +
       @@ -70,7 +70,7 @@ class Raw
                                "data" +
                                        [ raw.length ].pack("V") +
                                raw
       -        end 
       +        end
        
                def to_flow(opts={})
        
       @@ -238,6 +238,10 @@ class Raw
                        "{" + to_freq_sig(opts).sort.join(",") + "}"
                end
        
       +        def to_freq_sig_arr(opts={})
       +                to_freq_sig(opts)
       +        end
       +
                def self.fft_to_freq_sig(ffts, freq_cnt)
                        sig = []
                        ffts.each do |s|
       @@ -323,4 +327,3 @@ class Raw
        end
        end
        end
       -
   DIR diff --git a/lib/warvox/jobs/analysis.rb b/lib/warvox/jobs/analysis.rb
       @@ -4,7 +4,6 @@ class Analysis < Base
        
                require 'fileutils'
                require 'tempfile'
       -        require 'yaml'
                require 'open3'
        
                @@kissfft_loaded = false
       @@ -52,6 +51,7 @@ class Analysis < Base
                end
        
                def start
       +
                        @status = 'active'
        
                        begin
       @@ -59,6 +59,7 @@ class Analysis < Base
        
                        model = get_job
                        model.processed = true
       +
                        db_save(model)
        
                        stop()
       @@ -104,8 +105,6 @@ class Analysis < Base
                def run_analyze_call(r)
                        $stderr.puts "DEBUG: Processing audio for #{r.number}..."
        
       -
       -
                        bin = File.join(WarVOX::Base, 'bin', 'analyze_result.rb')
                        tmp = Tempfile.new("Analysis")
                        begin
       @@ -115,16 +114,13 @@ class Analysis < Base
                        end
        
                        pfd = IO.popen("#{bin} '#{tmp.path}'")
       -                out = YAML.load(pfd.read)
       +                out = Marshal.load(pfd.read)
                        pfd.close
        
                        return if not out
        
                        out.each_key do |k|
       -                        setter = "#{k.to_s}="
       -                        if(r.respond_to?(setter))
       -                                r.send(setter, out[k])
       -                        end
       +                        r[k] = out[k]
                        end
        
                        r.processed_at = Time.now
       @@ -155,7 +151,7 @@ class Analysis < Base
                        raw  = WarVOX::Audio::Raw.from_file(input)
                        fft  = KissFFT.fftr(8192, 8000, 1, raw.samples)
        
       -                freq = raw.to_freq_sig_txt()
       +                freq = raw.to_freq_sig_arr()
        
                        # Save the signature data
                        res[:fprint] = freq
   DIR diff --git a/lib/warvox/jobs/dialer.rb b/lib/warvox/jobs/dialer.rb
       @@ -216,4 +216,3 @@ class Dialer < Base
        end
        end
        end
       -