Integrated track marker test case and fixed parser

This commit is contained in:
Jamie Hardt
2025-05-17 12:05:27 -07:00
parent 914783a809
commit c3a600c5d7
3 changed files with 11 additions and 7 deletions

View File

@@ -86,8 +86,8 @@ protools_text_export_grammar = Grammar(
"COMMENTS" rs "COMMENTS" rs
marker_record = integer_value isp fs string_value fs integer_value isp fs marker_record = integer_value isp fs string_value fs integer_value isp fs
string_value fs string_value fs (string_value fs string_value fs string_value fs
string_value fs)? string_value rs (string_value fs string_value fs)? string_value rs
fs = "\t" fs = "\t"
rs = "\n" rs = "\n"
@@ -245,8 +245,8 @@ class DocParserVisitor(NodeVisitor):
@staticmethod @staticmethod
def visit_marker_record(_, visited_children): def visit_marker_record(_, visited_children):
is_track_marker = False is_track_marker = False
if isinstance(visited_children[12], list): if isinstance(visited_children[12][0], list):
is_track_marker = visited_children[12][2] == "Track" is_track_marker = visited_children[12][0][2] == "Track"
return MarkerDescriptor(number=visited_children[0], return MarkerDescriptor(number=visited_children[0],
location=visited_children[3], location=visited_children[3],

View File

@@ -20,5 +20,5 @@ CHANNEL EVENT CLIP NAME START TIME END TIME D
M A R K E R S L I S T I N G M A R K E R S L I S T I N G
# LOCATION TIME REFERENCE UNITS NAME TRACK NAME TRACK TYPE COMMENTS # LOCATION TIME REFERENCE UNITS NAME TRACK NAME TRACK TYPE COMMENTS
1 00:00:00:00 0 Samples $Title=Multiple Marker Rulers Project Markers Ruler 1 00:00:00:00 0 Samples {Title=Multiple Marker Rulers Project} Markers Ruler
2 00:00:04:00 192192 Samples Track Marker Hamlet Track 2 00:00:04:00 192192 Samples Track Marker Hamlet Track

View File

@@ -2,6 +2,7 @@ import unittest
import tempfile import tempfile
import sys
import os.path import os.path
import os import os
import glob import glob
@@ -15,14 +16,17 @@ class TestPDFExport(unittest.TestCase):
be converted into PDF docs without throwing an error be converted into PDF docs without throwing an error
""" """
files = [os.path.dirname(__file__) + "/../export_cases/Robin Hood Spotting.txt"] files = [os.path.dirname(__file__) + "/../export_cases/Robin Hood Spotting.txt"]
#files.append(os.path.dirname(__file__) + "/../export_cases/Robin Hood Spotting2.txt") files.append(os.path.dirname(__file__) + "/../export_cases/Test for ptulsconv.txt")
for path in files: for path in files:
tempdir = tempfile.TemporaryDirectory() tempdir = tempfile.TemporaryDirectory()
os.chdir(tempdir.name) os.chdir(tempdir.name)
try: try:
commands.convert(input_file=path, major_mode='doc') commands.convert(input_file=path, major_mode='doc')
except: except:
assert False, "Error processing file %s" % path print("Error in test_report_generation")
print(f"File: {path}")
print(repr(sys.exception()))
raise sys.exception()
finally: finally:
tempdir.cleanup() tempdir.cleanup()