[gimp-web/testing] Try to write a json file for easy mirror selection with some javascript
- From: Michael Schumacher <schumaml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-web/testing] Try to write a json file for easy mirror selection with some javascript
- Date: Tue, 24 Feb 2015 00:13:20 +0000 (UTC)
commit a45fc5cfcd1668fa21fcc98d6476933f89657149
Author: Michael Schumacher <schumaml gmx de>
Date: Tue Feb 24 01:12:06 2015 +0100
Try to write a json file for easy mirror selection with some javascript
programmatic/downloads/mirrorfmt.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/programmatic/downloads/mirrorfmt.py b/programmatic/downloads/mirrorfmt.py
index d2dd699..d5bb859 100644
--- a/programmatic/downloads/mirrorfmt.py
+++ b/programmatic/downloads/mirrorfmt.py
@@ -8,10 +8,13 @@ import string
def do_file(filename):
fp = open(filename, "r")
+ fj = open(filename + ".json", w)
print "<!-- This file automatically generated by mirrorfmt.py $Revision$ -->"
print "<!-- DO NOT EDIT THIS FILE - edit the master file MIRRORS instead -->"
print xhtml.dl.init({"class" : "download-mirror"})
+ print >>fj, '"mirrors_http":[\n'
+
for l in fp:
l = l.rstrip()
if len(l) > 1:
@@ -28,23 +31,28 @@ def do_file(filename):
# split the link (before whitespace) from the comment
print xhtml.dd(xhtml.hyperlink(l[0:idx], {"href" : l[0:idx]})
+ l[idx:len(l)])
+ if l.startswith("http"):
+ print >>fj, l[0:idx] + ",\n"
else:
print xhtml.dd(xhtml.hyperlink(l, {"href" : l}))
+ if l.startswith("http"):
+ print >>fj, l[0:idx] + ",\n"
pass
pass
pass
+ print >>fj, "];"
print xhtml.dl.fini()
fp.close()
-
+ fj.close()
+
return
def main(argv):
for a in argv:
do_file(a)
pass
-
+
return
-
-main(sys.argv[1:])
+main(sys.argv[1:])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]