public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/
@ 2020-04-27 19:12 Max Magorsch
  0 siblings, 0 replies; 2+ messages in thread
From: Max Magorsch @ 2020-04-27 19:12 UTC (permalink / raw
  To: gentoo-commits

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

Add the timestamp of the last update to the json files

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

 json/generate-json.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/json/generate-json.py b/json/generate-json.py
index 1786bf9..ced3cc8 100755
--- a/json/generate-json.py
+++ b/json/generate-json.py
@@ -15,6 +15,7 @@
 
 import json
 import sys
+import time
 
 try:
     with open(str(sys.argv[1])) as file_in:
@@ -41,7 +42,10 @@ try:
 
             mirrors[url].append(state)
 
-        print(json.dumps(mirrors))
+        data = {}
+        data["LastUpdate"] = int(time.time())
+        data["Mirrors"] = mirrors
+        print(json.dumps(data))
 
 except Exception as e:
     print("Could not convert mirmon state file to json: " + str(e), file=sys.stderr)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/
@ 2020-04-27 19:23 Max Magorsch
  0 siblings, 0 replies; 2+ messages in thread
From: Max Magorsch @ 2020-04-27 19:23 UTC (permalink / raw
  To: gentoo-commits

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())


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-27 19:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 19:23 [gentoo-commits] proj/gentoo-mirrorstats:master commit in: json/ Max Magorsch
  -- strict thread matches above, loose matches on Subject: below --
2020-04-27 19:12 Max Magorsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox