# HG changeset patch # User Brecht De Man # Date 1435600968 -3600 # Node ID ba83143187d687af6fb25e0add1a9762d2f42e35 # Parent 1dd20955056037a6bbb848f772f2ccaaa703463d Scripts: score_parser.py: ignore empty rows (subject with no ratings for current song) diff -r 1dd209550560 -r ba83143187d6 scripts/score_parser.py --- 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) diff -r 1dd209550560 -r ba83143187d6 scripts/timeline_view.py --- 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()