1 |
commit: 137484f7612b9b2ec741f94744d1e5e30ad895b5 |
2 |
Author: Max Magorsch <arzano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 27 19:11:14 2020 +0000 |
4 |
Commit: Max Magorsch <arzano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 27 19:11:14 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=137484f7 |
7 |
|
8 |
Add the timestamp of the last update to the json files |
9 |
|
10 |
Signed-off-by: Max Magorsch <arzano <AT> gentoo.org> |
11 |
|
12 |
json/generate-json.py | 6 +++++- |
13 |
1 file changed, 5 insertions(+), 1 deletion(-) |
14 |
|
15 |
diff --git a/json/generate-json.py b/json/generate-json.py |
16 |
index 1786bf9..ced3cc8 100755 |
17 |
--- a/json/generate-json.py |
18 |
+++ b/json/generate-json.py |
19 |
@@ -15,6 +15,7 @@ |
20 |
|
21 |
import json |
22 |
import sys |
23 |
+import time |
24 |
|
25 |
try: |
26 |
with open(str(sys.argv[1])) as file_in: |
27 |
@@ -41,7 +42,10 @@ try: |
28 |
|
29 |
mirrors[url].append(state) |
30 |
|
31 |
- print(json.dumps(mirrors)) |
32 |
+ data = {} |
33 |
+ data["LastUpdate"] = int(time.time()) |
34 |
+ data["Mirrors"] = mirrors |
35 |
+ print(json.dumps(data)) |
36 |
|
37 |
except Exception as e: |
38 |
print("Could not convert mirmon state file to json: " + str(e), file=sys.stderr) |