changeset 2996:eaa5dc4aedbf

Further fixes to #215. Fixed for MUSHRA and for outside-reference files
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 02 Aug 2017 08:29:23 +0100
parents ac6720456322
children a10cbbccc4f3
files python/generate_report.py python/score_parser.py python/timeline_view_movement.py
diffstat 3 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/python/generate_report.py	Wed Aug 02 08:10:46 2017 +0100
+++ b/python/generate_report.py	Wed Aug 02 08:29:23 2017 +0100
@@ -227,17 +227,18 @@
             
             # number of comments (interesting if comments not mandatory)
             for audioelement in audioelements:
-                response = audioelement.find("./comment/response")
-                was_played = audioelement.find("./metric/metricresult/[@name='elementFlagListenedTo']")
-                was_moved = audioelement.find("./metric/metricresult/[@name='elementFlagMoved']")
-                if response is not None and response.text is not None and len(response.text) > 1: 
-                    number_of_comments += 1
-                else: 
-                    number_of_missing_comments += 1
-                if was_played is not None and was_played.text == 'false': 
-                    not_played.append(audioelement.get('name'))
-                if was_moved is not None and was_moved.text == 'false': 
-                    not_moved.append(audioelement.get('name'))
+                if audioelement.get("type") != "outside-reference":
+                    response = audioelement.find("./comment/response")
+                    was_played = audioelement.find("./metric/metricresult/[@name='elementFlagListenedTo']")
+                    was_moved = audioelement.find("./metric/metricresult/[@name='elementFlagMoved']")
+                    if response is not None and response.text is not None and len(response.text) > 1: 
+                        number_of_comments += 1
+                    else: 
+                        number_of_missing_comments += 1
+                    if was_played is not None and was_played.text == 'false': 
+                        not_played.append(audioelement.get('name'))
+                    if was_moved is not None and was_moved.text == 'false': 
+                        not_moved.append(audioelement.get('name'))
             
             # update global counters
             total_empty_comments += number_of_missing_comments
--- a/python/score_parser.py	Wed Aug 02 08:10:46 2017 +0100
+++ b/python/score_parser.py	Wed Aug 02 08:29:23 2017 +0100
@@ -76,7 +76,8 @@
             # get alphabetical array of fragment IDs from this subject's XML
             fragmentnamelist = []    # make empty list
             for audioelement in page.findall("./audioelement"): # iterate over all audioelements
-                fragmentnamelist.append(audioelement.get('ref')) # add to list
+                if audioelement.get("type") != "outside-reference":
+                    fragmentnamelist.append(audioelement.get('ref')) # add to list
             
             fragmentnamelist = sorted(fragmentnamelist);    # Sort the list
             storage[page_name]['header'] = fragmentnamelist;
--- a/python/timeline_view_movement.py	Wed Aug 02 08:10:46 2017 +0100
+++ b/python/timeline_view_movement.py	Wed Aug 02 08:29:23 2017 +0100
@@ -112,6 +112,10 @@
                 if audioelement is not None: # Check it exists
                     audio_id = str(audioelement.get('ref'))
                     
+                    # break if outside-reference
+                    if audioelement.get("type") == "outside-reference":
+                        break;
+                    
                     # break if no initial position....
                     initial_position_temp = audioelement.find("./metric/metricresult/[@name='elementInitialPosition']")
                     if initial_position_temp is None: