From c9eef9d6ca30d1dce38de2ee2c3d76ef8a68e197 Mon Sep 17 00:00:00 2001 From: Jamie Hardt Date: Wed, 9 Oct 2019 16:45:48 -0700 Subject: [PATCH] Fixed some bad parsing behavior in a certain case --- ptulsconv/ptuls_grammar.py | 4 ++-- ptulsconv/ptuls_parser_visitor.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ptulsconv/ptuls_grammar.py b/ptulsconv/ptuls_grammar.py index 200d3bc..72afa67 100644 --- a/ptulsconv/ptuls_grammar.py +++ b/ptulsconv/ptuls_grammar.py @@ -14,13 +14,13 @@ protools_text_export_grammar = Grammar( 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 " fs "Location" rs + files_column_header = "Filename" isp fs "Location" rs file_record = string_value fs string_value rs clips_section = clips_header clips_column_header clip_record* block_ending clips_header = "O N L I N E C L I P S I N S E S S I O N" rs clips_column_header = string_value fs string_value rs - clip_record = string_value fs string_value fs "[" integer_value "]" rs + clip_record = string_value fs string_value (fs "[" integer_value "]")? rs plugin_listing = plugin_header plugin_column_header plugin_record* block_ending plugin_header = "P L U G - I N S L I S T I N G" rs diff --git a/ptulsconv/ptuls_parser_visitor.py b/ptulsconv/ptuls_parser_visitor.py index 5136497..0e55a63 100644 --- a/ptulsconv/ptuls_parser_visitor.py +++ b/ptulsconv/ptuls_parser_visitor.py @@ -40,7 +40,9 @@ class DictionaryParserVisitor(NodeVisitor): @staticmethod def visit_clips_section(node, visited_children): - return list(map(lambda child: dict(clip_name=child[0], file=child[2], channel=child[5]), + channel = next(iter(visited_children[2][5]), 1) + + return list(map(lambda child: dict(clip_name=child[0], file=child[2], channel=channel), visited_children[2])) @staticmethod