From: | "Camille Huot (cam)" <cam@g.o> |
---|---|
To: | gentoo-commits@l.g.o |
Subject: | [gentoo-commits] gentoo commit in users/cam/topdocs: top.sh |
Date: | Wed, 10 Oct 2007 00:36:51 |
Message-Id: | E1IfPPk-0007lt-Ug@stork.gentoo.org |
1 | cam 07/10/10 00:27:04 |
2 | |
3 | Added: top.sh |
4 | Log: |
5 | New: a tool to handle topdocs.xml files |
6 | |
7 | Revision Changes Path |
8 | 1.1 users/cam/topdocs/top.sh |
9 | |
10 | file : http://sources.gentoo.org/viewcvs.py/gentoo/users/cam/topdocs/top.sh?rev=1.1&view=markup |
11 | plain: http://sources.gentoo.org/viewcvs.py/gentoo/users/cam/topdocs/top.sh?rev=1.1&content-type=text/plain |
12 | |
13 | Index: top.sh |
14 | =================================================================== |
15 | #!/bin/sh |
16 | |
17 | # some tools to handle topdocs file |
18 | |
19 | DATE="$(date +%Y%m%d)" |
20 | |
21 | function get() { |
22 | output=topdocs-${DATE}.xml |
23 | if [ -r "$output" ]; then return; fi |
24 | wget -O "$output" http://www.gentoo.org/proj/en/gdp/tests/topdocs.xml?passthru=1 |
25 | } |
26 | function order() { |
27 | get |
28 | output=order-${DATE}.txt |
29 | if [ -r "$output" ]; then return; fi |
30 | cat topdocs-${DATE}.xml | grep "^<tr><ti>" | sed -e "s/<[^>]*>/ /g" -e "s/,//g" | awk '{ print $4" "$2 }' | sort -nr > "$output" |
31 | } |
32 | function help() { |
33 | echo "Usage: $0 <get|order>" |
34 | echo "ie.: $0 order to get the last list of top docs viewed on gentoo.org," |
35 | echo "ordered by English hits (ie. excluding translations)" |
36 | exit |
37 | } |
38 | |
39 | if [ $# -ne 1 ]; then help; fi |
40 | case "$1" in |
41 | "get") |
42 | get |
43 | ;; |
44 | "order") |
45 | order |
46 | ;; |
47 | *) |
48 | help |
49 | ;; |
50 | esac |
51 | |
52 | |
53 | |
54 | |
55 | -- |
56 | gentoo-commits@g.o mailing list |