URI: 
       List export function - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit 8efdd0d3eeb997d0961cb507ed57d97d0842fe63
   DIR parent 235e8064ff4e47777e2dd770ea7ee424ceece55b
  HTML Author: HD Moore <hd_moore@rapid7.com>
       Date:   Mon, 27 Apr 2009 15:29:02 +0000
       
       List export function
       
       
       Diffstat:
         A bin/export_list.rb                  |      57 +++++++++++++++++++++++++++++++
       
       1 file changed, 57 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/bin/export_list.rb b/bin/export_list.rb
       @@ -0,0 +1,57 @@
       +#!/usr/bin/env ruby
       +###################
       +
       +#
       +# 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'
       +
       +ENV['RAILS_ENV'] ||= 'production'
       +
       +$:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'web'))
       +require 'config/boot'
       +require 'config/environment'
       +
       +def usage
       +        $stderr.puts "Usage: #{$0} [Job ID] <Type>"
       +        exit
       +end
       +
       +#
       +# Script
       +#
       +
       +job = ARGV.shift
       +typ = ARGV.shift
       +
       +if(job and job == "-h")
       +        usage()
       +end
       +
       +if(not job)
       +        $stderr.puts "Listing all available jobs"
       +        $stderr.puts "=========================="
       +        DialJob.find(:all).each do |j|
       +                puts "#{j.id}\t#{j.started_at} --> #{j.completed_at}"
       +        end
       +        exit
       +end
       +
       +begin
       +        job = DialJob.find(job.to_i)
       +        job.dial_results.sort{|a,b| a.number <=> b.number}.each do |r|
       +                if(not typ or typ.downcase == (r.line_type||"").downcase)
       +                        puts "#{r.number}\t#{r.line_type}\tbusy=#{r.busy}\tring=#{r.ringtime}"
       +                end
       +        end
       +rescue ActiveRecord::RecordNotFound
       +        $stderr.puts "Job not found"
       +        exit
       +end
       +