Add script to convert html download stats to CSV
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 3 Oct 2016 01:07:55 +0000 (21:07 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 6 Oct 2016 21:05:34 +0000 (17:05 -0400)
Useful to see stats of dowloaded RCPs.
Converts results from this page to CSV:
https://dev.eclipse.org/committers/committertools/stats.php

Change-Id: I15c95c4f7dad5486ac0f20182aa400d1ef4d860c
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/82341
Reviewed-by: Hudson CI
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
releng/scripts/html_rcp_download_stats_to_csv.py [new file with mode: 0644]

diff --git a/releng/scripts/html_rcp_download_stats_to_csv.py b/releng/scripts/html_rcp_download_stats_to_csv.py
new file mode 100644 (file)
index 0000000..32fab82
--- /dev/null
@@ -0,0 +1,33 @@
+###############################################################################
+# Copyright (c) 2016 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+
+#args: filename
+
+# Parses the HTML of download stats and converts it to CSV
+#
+# Example usage:
+# 1. Login to eclipse.org with your acount and open this page:
+#https://dev.eclipse.org/committers/committertools/stats.php?filename=/tracecompass/releases/%trace-compass%
+# 2. Save this page as HTML
+# 3. python html_rcp_download_stats_to_csv.py page.html > out.csv
+
+# Example html content
+#                      <td><a href="javascript:fnViewDaily('/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-linux.gtk.x86_64.tar.gz',%20'daily');">/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-linux.gtk.x86_64.tar.gz</a></td>
+#                      <td align="right">3</td>
+# ...
+#                      <td><a href="javascript:fnViewDaily('/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-win32.win32.x86_64.zip',%20'daily');">/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-win32.win32.x86_64.zip</a></td>
+#                      <td align="right">5</td>
+
+
+import sys, re
+fileContent = open(sys.argv[1]).read()
+matchObject = re.finditer(".*releases/(\d+.\d+.\d+)/.*trace-compass-\d+\.\d+\.\d+-\d+-\d+-(.*)\..*\.(.*)\.(tar|zip).*\..*\n.*right\">(\d+).*", fileContent)
+for m in matchObject:
+       print(m.group(1) + "," + m.group(2) + "," + m.group(3) + "," + m.group(5))
+
This page took 0.025735 seconds and 5 git commands to generate.