diff --git a/workers/closest.py b/workers/closest.py index 3c9e0a8..568a5df 100644 --- a/workers/closest.py +++ b/workers/closest.py @@ -70,6 +70,7 @@ def worker(lat, lon, distance = 1000, json = False): outtext += ",\n" if (json and not outtext.strip()[-1] == "[") else "" station.distance = station.distance or int(cDistance(station.lat(), station.lon(), lat, lon)) outtext += station.json(2, distance = True) if json else station.xml(1, distance = True) + outtext += "\n" if not json else "" outtext += """ ] diff --git a/workers/val.py b/workers/val.py index 77c9ec6..3d890f6 100644 --- a/workers/val.py +++ b/workers/val.py @@ -22,14 +22,20 @@ def validateName(name): yield Station(name = name, sttype = sttype, extid = extid, xcoord = xcoord, ycoord = ycoord, prodclass = prodclass) def worker(name, json = False): - outtext = """ + outtext = """{ + "stations": [ +""" if json else """ """ for station in validateName(name): - outtext += station.xml(1) + outtext += ",\n" if (json and not outtext.strip()[-1] == "[") else "" + outtext += station.json(2) if json else station.xml(1) + outtext += "\n" if not json else "" - outtext += "" + outtext += """ + ] +}""" if json else "" return outtext