commit:     0f28dae401157afc08aede61016ad363ac344bd8
Author:     Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 27 19:23:11 2020 +0000
Commit:     Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Mon Apr 27 19:23:11 2020 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0f28dae4

Add the host of the mirror to the json files

Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>

 json/generate-json.py | 12 +++++++-----
 1 file 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())

Reply via email to