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)

Reply via email to