Add destination directory argument and write content instead of piping.

This commit is contained in:
Daniel Ehlers 2013-11-18 10:58:12 +01:00
parent 9a85fd0c97
commit 1b0e830e16
2 changed files with 7 additions and 2 deletions

View file

@ -28,6 +28,9 @@ parser.add_argument('-g', '--gateway', action='append',
parser.add_argument('batmanjson', help='output of batman vd json') parser.add_argument('batmanjson', help='output of batman vd json')
parser.add_argument('-d', '--destination-directory', action='store',
help='destination directory for generated files',required=True)
args = parser.parse_args() args = parser.parse_args()
options = vars(args) options = vars(args)
@ -44,4 +47,6 @@ if options['gateway']:
m = D3MapBuilder(db) m = D3MapBuilder(db)
print(m.build()) nodes_json = open(options['destination_directory'] + '/nodes.json.new','w')
nodes_json.write(m.build())
nodes_json.close()

View file

@ -20,7 +20,7 @@ fi
"$(dirname "$0")"/ffhlwiki.py http://freifunk.metameute.de/wiki/Knoten > "$(dirname "$0")"/aliases_hl.json "$(dirname "$0")"/ffhlwiki.py http://freifunk.metameute.de/wiki/Knoten > "$(dirname "$0")"/aliases_hl.json
"$(dirname "$0")"/ffhlwiki.py http://freifunk.metameute.de/wiki/Moelln:Knoten > "$(dirname "$0")"/aliases_moelln.json "$(dirname "$0")"/ffhlwiki.py http://freifunk.metameute.de/wiki/Moelln:Knoten > "$(dirname "$0")"/aliases_moelln.json
batctl vd json -n | "$(dirname "$0")"/bat2nodes.py -a "$(dirname "$0")"/aliases.json -a aliases_hl.json -a aliases_moelln.json $GWS - > $DEST/nodes.json.new batctl vd json -n | "$(dirname "$0")"/bat2nodes.py -a "$(dirname "$0")"/aliases.json -a aliases_hl.json -a aliases_moelln.json -d $DEST $GWS -
mv $DEST/nodes.json.new $DEST/nodes.json mv $DEST/nodes.json.new $DEST/nodes.json