summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-04-27 21:23:11 +0200
committerMax Magorsch <arzano@gentoo.org>2020-04-27 21:23:11 +0200
commit0f28dae401157afc08aede61016ad363ac344bd8 (patch)
tree9eba7bd822f5d3bdbb4ab0b9bd1534c1964bfe26
parentAdd the timestamp of the last update to the json files (diff)
downloadgentoo-mirrorstats-0f28dae401157afc08aede61016ad363ac344bd8.tar.gz
gentoo-mirrorstats-0f28dae401157afc08aede61016ad363ac344bd8.tar.bz2
gentoo-mirrorstats-0f28dae401157afc08aede61016ad363ac344bd8.zip
Add the host of the mirror to the json files
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rwxr-xr-xjson/generate-json.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/json/generate-json.py b/json/generate-json.py
index ced3cc8..c452e81 100755
--- a/json/generate-json.py
+++ b/json/generate-json.py
@@ -24,11 +24,13 @@ try:
line = raw_line.split(" ")
protocol = line[0].split("://")[0]
- url = line[0].split("://")[1]
+ host = line[0].split("://")[1]
+ host = host.split("/")[0]
state = {
"Protocol" : protocol,
- "Url" : url,
+ "Host" : host,
+ "Url" : line[0],
"Age" : line[1],
"StatusLastProbe" : line[2],
"TimeLastSuccessfulProbe" : line[3],
@@ -37,10 +39,10 @@ try:
"LastProbe" : line[6].strip(),
}
- if url not in mirrors:
- mirrors[url] = []
+ if host not in mirrors:
+ mirrors[host] = []
- mirrors[url].append(state)
+ mirrors[host].append(state)
data = {}
data["LastUpdate"] = int(time.time())