You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2017/12/12 01:19:24 UTC

[whimsy] branch master updated: Finish mbox download features

This is an automated email from the ASF dual-hosted git repository.

curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 66fbd5f  Finish mbox download features
66fbd5f is described below

commit 66fbd5f642d9935369cbd32985500821ef3be79a
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Mon Dec 11 20:21:24 2017 -0500

    Finish mbox download features
---
 tools/ponyapi.rb  | 10 ++++++++++
 tools/ponypoop.rb |  8 +++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/tools/ponyapi.rb b/tools/ponyapi.rb
index c8be57d..5dc09fa 100644
--- a/tools/ponyapi.rb
+++ b/tools/ponyapi.rb
@@ -85,4 +85,14 @@ module PonyAPI
       puts "ERROR:get_public_mbox(#{uri}) returned code #{response.code}"
     end
   end
+  
+  # Get multiple years/months of mboxes
+  def get_pony_mbox_many(dir, list, subdomain, years, months, cookie)
+    years.each do |y|
+      months.each do |m|
+        get_pony_mbox dir, list, subdomain, y, m, cookie
+      end
+      sleep(1) # Be nice to the server; mboxes take effort
+    end
+  end
 end
\ No newline at end of file
diff --git a/tools/ponypoop.rb b/tools/ponypoop.rb
index f9cbcb3..de112e8 100755
--- a/tools/ponypoop.rb
+++ b/tools/ponypoop.rb
@@ -168,9 +168,12 @@ def optparse
       options[:subdomain] = s.chomp('@.')
     end
     
-    opts.on('-p', '--pull', 'Pull down stats into -d dir (otherwise, default analyzes existing stats in dir)') do |p|
+    opts.on('-p', '--pull', 'Pull down stats JSON files into -d dir (otherwise, default analyzes existing stats JSON in dir)') do |p|
       options[:pull] = true
     end
+    opts.on('-m', '--mbox', 'Pull down mbox files into -d dir') do |p|
+      options[:mbox] = true
+    end
     
     begin
       opts.parse!
@@ -194,6 +197,9 @@ if __FILE__ == $PROGRAM_NAME
   if options[:pull]
     puts "BEGIN: Pulling down stats JSONs in #{options[:dir]} of list: #{options[:list]}@#{options[:subdomain]}"
     PonyAPI::get_pony_stats_many options[:dir], options[:list], options[:subdomain], years, months, options[:cookie]
+  elsif options[:mbox]
+    puts "BEGIN: Pulling down mboxes in #{options[:dir]} of list: #{options[:list]}@#{options[:subdomain]}"
+    PonyAPI::get_pony_mbox_many options[:dir], options[:list], options[:subdomain], years, months, options[:cookie]
   else
     puts "BEGIN: Analyzing local JSONs in #{options[:dir]} of list: #{options[:list]}"
     run_analyze_stats options[:dir], options[:list], BOARD_REGEX

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].