Mercurial > hg > webaudioevaluationtool
changeset 247:c3f29c2b9b12
Scripts: score_parser.py: ignore empty rows (subject with no ratings for current song)
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Mon, 29 Jun 2015 19:02:48 +0100 |
parents | 83584c6b09b5 |
children | 3bda6ed7cc6a |
files | scripts/score_parser.py scripts/timeline_view.py |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/score_parser.py Mon Jun 29 17:19:46 2015 +0100 +++ b/scripts/score_parser.py Mon Jun 29 19:02:48 2015 +0100 @@ -10,7 +10,7 @@ folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder # get every XML file in folder -for file in os.listdir(folder_name): # You have to put this in folder where output XML files are. +for file in os.listdir(folder_name): if file.endswith(".xml"): tree = ET.parse(folder_name + '/' + file) root = tree.getroot() @@ -57,7 +57,6 @@ newfragments = sorted(newfragments) # new fragments in alphabetical order # If not empty, read file and rewrite adding extra columns if newfragments: # if not empty - print ' '+page_name+','+file_name+','+subject_id #print "DEBUG New fragments found: " + str(newfragments) with open('temp.csv', 'w') as writefile: filewriter = csv.writer(writefile, delimiter=',') @@ -102,5 +101,6 @@ ratingrow.append('') # append empty cell # write row: [subject ID, rating fragment ID 1, ..., rating fragment ID M] - filewriter.writerow(ratingrow) + if any(ratingrow[1:]): # append to file if row non-empty (except subject name) + filewriter.writerow(ratingrow)
--- a/scripts/timeline_view.py Mon Jun 29 17:19:46 2015 +0100 +++ b/scripts/timeline_view.py Mon Jun 29 19:02:48 2015 +0100 @@ -28,7 +28,7 @@ os.makedirs(timeline_folder) # get every XML file in folder -for file in os.listdir(folder_name): # You have to put this script in folder where output XML files are. +for file in os.listdir(folder_name): if file.endswith(".xml"): tree = ET.parse(folder_name + '/' + file) root = tree.getroot()