Author: robweir
Date: Mon May 28 20:03:15 2012
New Revision: 1343383

URL: http://svn.apache.org/viewvc?rev=1343383&view=rev
Log:
Add two new scripts

Added:
    incubator/ooo/devtools/aoo-stats/countries.py   (with props)
    incubator/ooo/devtools/aoo-stats/get-aoo-stats.py   (with props)

Added: incubator/ooo/devtools/aoo-stats/countries.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/devtools/aoo-stats/countries.py?rev=1343383&view=auto
==============================================================================
--- incubator/ooo/devtools/aoo-stats/countries.py (added)
+++ incubator/ooo/devtools/aoo-stats/countries.py Mon May 28 20:03:15 2012
@@ -0,0 +1,200 @@
+################################################################
+# 
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#  
+################################################################
+
+
+# In order to speed up the script on repeat executions, partial results
+# are cachced in the ./cache directory
+
+
+import urllib
+import json
+import os
+import hashlib
+import datetime
+import time
+
+from urllib import urlencode
+
+def getSourceForgeStats(download, start_date, end_date):
+
+    url = download + "/stats/json?start_date=" + start_date + "&" "end_date=" 
+ end_date
+    
+    return urllib.urlopen(url).read()
+
+#extracts the language code from the URL
+# this logic is very sensitive to the exact naming conventions
+def getLanguage(url):
+
+    s = str(url)
+
+    if s.endswith('.exe'):
+        s = s[:-4]
+    elif s.endswith('.dmg'):
+        s = s[:-4]
+    elif s.endswith('.tar.gz'):
+        s = s[:-7]
+
+    return s[s.rfind("_")+1:len(s)]
+
+
+#all of the URLs for AOO 3.4 install downloads, excluding SDK's and langpacks
+downloads = [          
+    
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_ar.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_ar.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_zh-CN.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_zh-CN.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_zh-TW.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_zh-TW.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_cs.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_cs.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_nl.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_nl.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_en-US.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_en-US.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_fr.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_fr.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_gl.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_gl.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_de.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_de.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_hu.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_hu.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_it.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_it.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_ja.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_ja.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_pt-BR.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_pt-BR.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_ru.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_ru.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_es.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_es.dmg";
 ,
+]
+
+
+# dictionary of language code to country_dict (dictionary of country name to  
count)
+master_dict = {}
+
+def mergeCountries(lang, countries):
+    country_dict = {}
+
+    if lang in master_dict:
+        country_dict = master_dict[lang]
+    else:
+        master_dict[lang] = country_dict
+
+    for country_tuple in countries:
+
+        country_name = country_tuple[0]
+        country_count = country_tuple[1]
+
+        if country_name in country_dict:
+            country_dict[country_name] = country_dict[country_name] + 
country_count
+        else:
+            country_dict[country_name] = country_count
+
+    
+
+for download in downloads :
+
+    # Remember that range functions do not include the end value, so set range 
to n+1 if you want to include date n
+
+    start_date = "2012-05-07"
+    end_date = "2012-05-28"
+        
+    data = json.loads(getSourceForgeStats(download,start_date, end_date))
+
+    lang = getLanguage(download)
+
+    countries = data["countries"]
+
+    mergeCountries(lang, countries)
+
+for lang in master_dict:
+    print "===" + lang + "==="
+    country_dict = master_dict[lang]
+    for country in sorted(country_dict,key=lambda x: country_dict[x], 
reverse=True):
+        out_str = country + "," + str(country_dict[country])
+        print out_str.encode("utf-8")
+    print
+    print
+
+

Propchange: incubator/ooo/devtools/aoo-stats/countries.py
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/ooo/devtools/aoo-stats/get-aoo-stats.py
URL: 
http://svn.apache.org/viewvc/incubator/ooo/devtools/aoo-stats/get-aoo-stats.py?rev=1343383&view=auto
==============================================================================
--- incubator/ooo/devtools/aoo-stats/get-aoo-stats.py (added)
+++ incubator/ooo/devtools/aoo-stats/get-aoo-stats.py Mon May 28 20:03:15 2012
@@ -0,0 +1,150 @@
+################################################################
+# 
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#  
+################################################################
+
+
+# This script queries the SourceForce REST API for download statistics for
+# Apche OpenOffice 3.4 downloads on a given date, in ISO format (YYYY-MM-DD)
+# passed in as a command line argument.  The download count for that date
+# is written to stdout.
+
+
+import urllib
+import json
+import sys
+
+from urllib import urlencode
+
+def getSourceForgeStats(download,date):
+
+    url = download + "/stats/json?start_date=" + date + "&" "end_date=" + date
+    
+    return urllib.urlopen(url).read()
+
+
+#all of the URLs for AOO 3.4 install downloads
+downloads = [          
+    
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_ar.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_ar.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ar/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_ar.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_zh-CN.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_zh-CN.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-CN/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_zh-CN.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_zh-TW.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_zh-TW.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/zh-TW/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_zh-TW.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_cs.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_cs.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/cs/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_cs.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_nl.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_nl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/nl/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_nl.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_en-US.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_en-US.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/stable/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_en-US.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_fr.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_fr.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/fr/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_fr.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_gl.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_gl.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/gl/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_gl.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_de.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_de.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/de/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_de.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_hu.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_hu.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/hu/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_hu.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_it.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_it.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/it/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_it.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_ja.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_ja.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ja/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_ja.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_pt-BR.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_pt-BR.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/pt-BR/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_pt-BR.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_ru.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_ru.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/ru/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_ru.dmg";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Win_x86_install_es.exe";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-rpm_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86_install-deb_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-rpm_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_Linux_x86-64_install-deb_es.tar.gz";
 ,
+       
"http://sourceforge.net/projects/openofficeorg.mirror/files/localized/es/3.4.0/Apache_OpenOffice_incubating_3.4.0_MacOS_x86_install_es.dmg";
 
+]
+
+
+count = 0
+
+for download in downloads :
+
+    date = sys.argv[1]
+
+    data = json.loads(getSourceForgeStats(download,date))
+
+    count = count + data["total"]
+
+print str(count)
+
+
+

Propchange: incubator/ooo/devtools/aoo-stats/get-aoo-stats.py
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to