Mercurial > hg > webaudioevaluationtool
comparison scripts/score_parser.py @ 1063:e67a76e9ba7a
Scripts: choose input/output folder from command line; score_plot also choose options from command line (WIP)
author | Brecht De Man <BrechtDeMan@users.noreply.github.com> |
---|---|
date | Mon, 20 Jul 2015 12:47:16 +0100 |
parents | b7fd0296c6ab |
children | 99cb3436759e |
comparison
equal
deleted
inserted
replaced
1062:3e84741cca7a | 1063:e67a76e9ba7a |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import xml.etree.ElementTree as ET | 3 import xml.etree.ElementTree as ET |
4 import os | 4 import os |
5 import sys | |
5 import csv | 6 import csv |
6 | 7 |
7 #TODO Remove DEBUG statements | 8 #TODO Remove DEBUG statements |
8 | 9 |
9 # XML results files location (modify as needed): | 10 # COMMAND LINE ARGUMENTS |
10 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder | 11 |
12 assert len(sys.argv)<3, "score_parser takes at most 1 command line argument\n"+\ | |
13 "Use: python score_parser.py [rating_folder_location]" | |
14 | |
15 # XML results files location | |
16 if len(sys.argv) == 1: | |
17 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder | |
18 print "Use: python score_parser.py [rating_folder_location]" | |
19 print "Using default path: " + folder_name | |
20 elif len(sys.argv) == 2: | |
21 folder_name = sys.argv[1] # First command line argument is folder | |
11 | 22 |
12 # get every XML file in folder | 23 # get every XML file in folder |
13 for file in os.listdir(folder_name): | 24 for file in os.listdir(folder_name): |
14 if file.endswith(".xml"): | 25 if file.endswith(".xml"): |
15 tree = ET.parse(folder_name + '/' + file) | 26 tree = ET.parse(folder_name + '/' + file) |