Adapting existing tests to new parser

This commit is contained in:
Jamie Hardt
2021-06-01 23:30:30 -07:00
parent 8654fdb847
commit 8d4058d026
4 changed files with 50 additions and 66 deletions

View File

@@ -81,6 +81,10 @@ class DocParserVisitor(NodeVisitor):
clips=clips
)
@staticmethod
def visit_frame_rate(node, _):
return node.text
@staticmethod
def visit_track_listing(_, visited_children):
return visited_children[1]

View File

@@ -7,11 +7,12 @@ protools_text_export_grammar = Grammar(
"SAMPLE RATE:" fs float_value rs
"BIT DEPTH:" fs integer_value "-bit" rs
"SESSION START TIMECODE:" fs string_value rs
"TIMECODE FORMAT:" fs float_value " Drop"? " Frame" rs
"TIMECODE FORMAT:" fs frame_rate " Drop"? " Frame" rs
"# OF AUDIO TRACKS:" fs integer_value rs
"# OF AUDIO CLIPS:" fs integer_value rs
"# OF AUDIO FILES:" fs integer_value rs block_ending
frame_rate = ("60" / "59.94" / "30" / "29.97" / "24" / "23.976")
files_section = files_header files_column_header file_record* block_ending
files_header = "F I L E S I N S E S S I O N" rs
files_column_header = "Filename" isp fs "Location" rs

View File

@@ -36,8 +36,8 @@ class TagCompiler:
track_comment_tags: dict,
timespan_tags: dict,
marker_tags: dict, session_tags: dict):
effective_tags = session_tags
effective_tags = dict()
effective_tags.update(session_tags)
effective_tags.update(marker_tags)
effective_tags.update(timespan_tags)
effective_tags.update(track_comment_tags)
@@ -99,7 +99,7 @@ class TagCompiler:
@staticmethod
def _time_span_tags(at_time: Fraction, applicable_spans) -> dict:
retval = dict()
for tags in [a[0] for a in applicable_spans if a.start <= at_time <= a.finish]:
for tags in [a[0] for a in applicable_spans if a[1] <= at_time <= a[2]]:
retval.update(tags)
return retval