Created
October 6, 2019 04:09
-
-
Save iluvcapra/cca9dd24faaaaf223006ca21238cb441 to your computer and use it in GitHub Desktop.
Pro Tools Text Export Parser Grammar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parsimonious.grammar import Grammar | |
protools_text_export_grammar = Grammar( | |
r""" | |
document = header files_section? clips_section? plugin_listing? track_listing? markers_listing? | |
header = "SESSION NAME:" fs field_value rs | |
"SAMPLE RATE:" fs field_value rs | |
"BIT DEPTH:" fs field_value rs | |
"SESSION START TIMECODE:" fs field_value rs | |
"TIMECODE FORMAT:" fs field_value rs | |
"# OF AUDIO TRACKS:" fs field_value rs | |
"# OF AUDIO CLIPS:" fs field_value rs | |
"# OF AUDIO FILES:" fs field_value rs rs rs | |
files_section = files_header files_column_header ( file_record )* rs rs | |
files_header = "F I L E S I N S E S S I O N" rs | |
files_column_header = "Filename " fs "Location" rs | |
file_record = field_value fs field_value rs | |
clips_section = clips_header clips_column_header ( clip_record )* rs rs | |
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 = field_value fs field_value rs | |
clip_record = field_value fs field_value fs field_value rs | |
plugin_listing = plugin_header plugin_column_header ( plugin_record rs )* rs rs | |
plugin_header = "P L U G - I N S L I S T I N G" rs | |
plugin_column_header = "MANUFACTURER " fs "PLUG-IN NAME " fs | |
"VERSION " fs "FORMAT " fs "STEMS " fs | |
"NUMBER OF INSTANCES" rs | |
plugin_record = field_value fs field_value fs field_value fs | |
field_value fs field_value fs field_value rs | |
track_listing = track_listing_header ( track_list )* | |
track_listing_header = "T R A C K L I S T I N G" rs | |
track_list = "TRACK NAME:" fs field_value rs | |
"COMMENTS:" fs field_value rs | |
"USER DELAY:" fs field_value rs | |
"STATE: " ( fs field_value )* rs | |
"PLUG-INS: " ( fs field_value )* rs | |
track_clip_list rs rs | |
track_clip_list = "CHANNEL " fs "EVENT " fs "CLIP NAME " fs | |
"START TIME " fs "END TIME " fs "DURATION " fs "STATE" rs | |
(track_clip_entry)* | |
track_clip_entry = field_value fs field_value fs field_value fs | |
field_value fs field_value fs field_value fs | |
field_value rs | |
markers_listing = markers_listing_header markers_column_header marker_record* | |
markers_listing_header = "M A R K E R S L I S T I N G" rs | |
markers_column_header = "# " fs "LOCATION " fs "TIME REFERENCE " fs | |
"UNITS " fs "NAME " fs "COMMENTS" rs | |
marker_record = field_value fs field_value fs field_value fs | |
field_value fs field_value fs field_value rs | |
fs = "\t" | |
rs = "\n" | |
ws = ws* | |
field_value = ~"[^\t\n]*" | |
""") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment