# HG changeset patch # User Brecht De Man # Date 1435600968 -3600 # Node ID c3f29c2b9b12beccb61ae1bf69820f0258a6cb6e # Parent 83584c6b09b52ad6b94ca167d91841dbcb9bcc3b Scripts: score_parser.py: ignore empty rows (subject with no ratings for current song) diff -r 83584c6b09b5 -r c3f29c2b9b12 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 83584c6b09b5 -r c3f29c2b9b12 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()