mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2026-04-01 19:52:30 +00:00
Drop frame recognition
This commit is contained in:
@@ -6,8 +6,8 @@ protools_text_export_grammar = Grammar(
|
||||
header = "SESSION NAME:" fs string_value rs
|
||||
"SAMPLE RATE:" fs float_value rs
|
||||
"BIT DEPTH:" fs integer_value "-bit" rs
|
||||
"SESSION START TIMECODE:" fs timecode_value rs
|
||||
"TIMECODE FORMAT:" fs float_value " Frame" rs
|
||||
"SESSION START TIMECODE:" fs string_value rs
|
||||
"TIMECODE FORMAT:" fs float_value " 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
|
||||
@@ -38,7 +38,7 @@ protools_text_export_grammar = Grammar(
|
||||
"COMMENTS:" fs string_value rs
|
||||
"USER DELAY:" fs integer_value " Samples" rs
|
||||
"STATE: " track_state_list rs
|
||||
"PLUG-INS: " ( fs string_value )* rs
|
||||
("PLUG-INS: " ( fs string_value )* rs)?
|
||||
"CHANNEL " fs "EVENT " fs "CLIP NAME " fs
|
||||
"START TIME " fs "END TIME " fs "DURATION " fs
|
||||
("TIMESTAMP " fs)? "STATE" rs
|
||||
@@ -50,7 +50,7 @@ protools_text_export_grammar = Grammar(
|
||||
track_clip_entry = integer_value isp fs
|
||||
integer_value isp fs
|
||||
string_value fs
|
||||
timecode_value fs timecode_value fs timecode_value fs (timecode_value fs)?
|
||||
string_value fs string_value fs string_value fs (string_value fs)?
|
||||
track_clip_state rs
|
||||
|
||||
track_clip_state = ("Muted" / "Unmuted")
|
||||
@@ -60,14 +60,13 @@ protools_text_export_grammar = Grammar(
|
||||
markers_column_header = "# " fs "LOCATION " fs "TIME REFERENCE " fs
|
||||
"UNITS " fs "NAME " fs "COMMENTS" rs
|
||||
|
||||
marker_record = integer_value isp fs timecode_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 rs
|
||||
|
||||
fs = "\t"
|
||||
rs = "\n"
|
||||
block_ending = rs rs
|
||||
string_value = ~"[^\t\n]*"
|
||||
timecode_value = ~"[^\d\t\n]*" ~"\d\d:\d\d:\d\d:\d\d(\.\d+)?" ~"[^\d\t\n]*"
|
||||
integer_value = ~"\d+"
|
||||
float_value = ~"\d+(\.\d+)"
|
||||
isp = ~"[^\d\t\n]*"
|
||||
|
||||
@@ -17,14 +17,20 @@ class DictionaryParserVisitor(NodeVisitor):
|
||||
markers=markers)
|
||||
|
||||
def visit_header(self, node, visited_children):
|
||||
|
||||
tc_drop = False
|
||||
for _ in visited_children[20]:
|
||||
tc_drop = True
|
||||
|
||||
return dict(session_name=visited_children[2],
|
||||
sample_rate=visited_children[6],
|
||||
bit_depth=visited_children[10],
|
||||
start_timecode=visited_children[15],
|
||||
timecode_format=visited_children[19],
|
||||
count_audio_tracks=visited_children[24],
|
||||
count_clips=visited_children[28],
|
||||
count_files=visited_children[32])
|
||||
timecode_drop_frame=tc_drop,
|
||||
count_audio_tracks=visited_children[25],
|
||||
count_clips=visited_children[29],
|
||||
count_files=visited_children[33])
|
||||
|
||||
def visit_files_section(self, node, visited_children):
|
||||
return list(map(lambda child: dict(filename=child[0], path=child[2]), visited_children[2]))
|
||||
@@ -50,8 +56,9 @@ class DictionaryParserVisitor(NodeVisitor):
|
||||
clips.append(clip[0])
|
||||
|
||||
plugins = []
|
||||
for plugin in track_header[17]:
|
||||
plugins.append(plugin[1])
|
||||
for plugin_opt in track_header[16]:
|
||||
for plugin in plugin_opt[1]:
|
||||
plugins.append(plugin[1])
|
||||
|
||||
return dict(
|
||||
name=track_header[2],
|
||||
@@ -114,8 +121,8 @@ class DictionaryParserVisitor(NodeVisitor):
|
||||
def visit_integer_value(self, node, visited_children):
|
||||
return int(node.text)
|
||||
|
||||
def visit_timecode_value(self, node, visited_children):
|
||||
return visited_children[1].text
|
||||
# def visit_timecode_value(self, node, visited_children):
|
||||
# return node.text.strip(" ")
|
||||
|
||||
def visit_float_value(self, node, visited_children):
|
||||
return float(node.text)
|
||||
|
||||
Reference in New Issue
Block a user