Mercurial > hg > webaudioevaluationtool
comparison python/timeline_view.py @ 2274:2b5990868aa7
timeline_view.py and timeline_view_movement.py compatible with Python 2.7 and 3.x: print ... --> print(...)
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Wed, 20 Apr 2016 19:12:16 +0200 |
parents | 556b79c72eee |
children | 3004c6a5665c |
comparison
equal
deleted
inserted
replaced
2273:ad2e070c92e5 | 2274:2b5990868aa7 |
---|---|
12 "Use: python timeline_view.py [XML_files_location]" | 12 "Use: python timeline_view.py [XML_files_location]" |
13 | 13 |
14 # XML results files location | 14 # XML results files location |
15 if len(sys.argv) == 1: | 15 if len(sys.argv) == 1: |
16 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder | 16 folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder |
17 print "Use: python timeline_view.py [XML_files_location]" | 17 print("Use: python timeline_view.py [XML_files_location]") |
18 print "Using default path: " + folder_name | 18 print("Using default path: " + folder_name) |
19 elif len(sys.argv) == 2: | 19 elif len(sys.argv) == 2: |
20 folder_name = sys.argv[1] # First command line argument is folder | 20 folder_name = sys.argv[1] # First command line argument is folder |
21 | 21 |
22 # check if folder_name exists | 22 # check if folder_name exists |
23 if not os.path.exists(folder_name): | 23 if not os.path.exists(folder_name): |
24 #the file is not there | 24 #the file is not there |
25 print "Folder '"+folder_name+"' does not exist." | 25 print("Folder '"+folder_name+"' does not exist.") |
26 sys.exit() # terminate script execution | 26 sys.exit() # terminate script execution |
27 elif not os.access(os.path.dirname(folder_name), os.W_OK): | 27 elif not os.access(os.path.dirname(folder_name), os.W_OK): |
28 #the file does exist but write privileges are not given | 28 #the file does exist but write privileges are not given |
29 print "No write privileges in folder '"+folder_name+"'." | 29 print("No write privileges in folder '"+folder_name+"'.") |
30 | 30 |
31 | 31 |
32 # CONFIGURATION | 32 # CONFIGURATION |
33 | 33 |
34 # Folder where to store timelines | 34 # Folder where to store timelines |
74 for audioholder in root.findall("./page"): # iterate over pages | 74 for audioholder in root.findall("./page"): # iterate over pages |
75 page_name = audioholder.get('ref') # get page name | 75 page_name = audioholder.get('ref') # get page name |
76 plot_empty = True # check if any data is plotted | 76 plot_empty = True # check if any data is plotted |
77 | 77 |
78 if page_name is None: # ignore 'empty' audio_holders | 78 if page_name is None: # ignore 'empty' audio_holders |
79 print "WARNING: " + file + " contains empty page. (comment_parser.py)" | 79 print("WARNING: " + file + " contains empty page. (comment_parser.py)") |
80 break | 80 break |
81 | 81 |
82 if audioholder.get("state") != "complete": | 82 if audioholder.get("state") != "complete": |
83 print "WARNING: " + file + "test page " + page_name + " is not complete, skipping." | 83 print("WARNING: " + file + "test page " + page_name + " is not complete, skipping.") |
84 break; | 84 break; |
85 # SORT AUDIO ELEMENTS ALPHABETICALLY | 85 # SORT AUDIO ELEMENTS ALPHABETICALLY |
86 audioelements = audioholder.findall("./audioelement") | 86 audioelements = audioholder.findall("./audioelement") |
87 | 87 |
88 data = [] | 88 data = [] |