mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 17:00:46 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17b87b6e69 | ||
|
|
a636791539 | ||
|
|
dfde3c4493 | ||
|
|
81909c8a51 | ||
|
|
e2b9a20870 | ||
|
|
006cec05e5 | ||
|
|
a95f0b5cca | ||
|
|
70a5206d73 | ||
|
|
128eed002d | ||
|
|
f8a0d70942 |
@@ -2,7 +2,7 @@
|
||||

|
||||

|
||||
[][pypi]
|
||||

|
||||

|
||||
[](https://github.com/iluvcapra/ptulsconv/actions/workflows/python-package.yml)
|
||||
|
||||
[pypi]: https://pypi.org/project/ptulsconv/
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
# ptulsconv
|
||||
|
||||
Read Pro Tools text exports and generate PDF reports, JSON output.
|
||||
Parse Pro Tools text exports and generate PDF reports, JSON output.
|
||||
|
||||
## Quick Start
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Parse and convert Pro Tools text exports
|
||||
"""
|
||||
|
||||
__version__ = '2.0.0'
|
||||
__version__ = '2.1.0'
|
||||
__author__ = 'Jamie Hardt'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = "%s %s (c) 2023 %s. All rights reserved." \
|
||||
|
||||
@@ -187,7 +187,7 @@ def convert(major_mode, input_file=None, output=sys.stdout, warnings=True):
|
||||
req.time_type("tc")
|
||||
req.dont_show_crossfades()
|
||||
req.selected_tracks_only()
|
||||
session_text = req.export_string
|
||||
session_text = req.export_string()
|
||||
|
||||
session = parse_document(session_text)
|
||||
session_tc_format = session.header.timecode_format
|
||||
|
||||
@@ -20,6 +20,9 @@ class SessionDescriptor:
|
||||
self.markers = kwargs['markers']
|
||||
|
||||
def markers_timed(self) -> Iterator[Tuple['MarkerDescriptor', Fraction]]:
|
||||
"""
|
||||
Iterate each marker in the session with its respective time reference.
|
||||
"""
|
||||
for marker in self.markers:
|
||||
marker_time = Fraction(marker.time_reference,
|
||||
int(self.header.sample_rate))
|
||||
@@ -28,6 +31,9 @@ class SessionDescriptor:
|
||||
|
||||
def tracks_clips(self) -> Iterator[Tuple['TrackDescriptor',
|
||||
'TrackClipDescriptor']]:
|
||||
"""
|
||||
Iterate each track clip with its respective owning clip.
|
||||
"""
|
||||
for track in self.tracks:
|
||||
for clip in track.clips:
|
||||
yield track, clip
|
||||
@@ -37,7 +43,10 @@ class SessionDescriptor:
|
||||
Fraction, Fraction, Fraction]
|
||||
]:
|
||||
"""
|
||||
:return: A Generator that yields track, clip, start time, finish time,
|
||||
Iterate each track clip with its respective owning clip and timing
|
||||
information.
|
||||
|
||||
:returns: A Generator that yields track, clip, start time, finish time,
|
||||
and timestamp
|
||||
"""
|
||||
for track, clip in self.tracks_clips():
|
||||
@@ -115,6 +124,7 @@ class HeaderDescriptor:
|
||||
|
||||
|
||||
class TrackDescriptor:
|
||||
index: int
|
||||
name: str
|
||||
comments: str
|
||||
user_delay_samples: int
|
||||
@@ -123,6 +133,7 @@ class TrackDescriptor:
|
||||
clips: List["TrackClipDescriptor"]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.index = kwargs['index']
|
||||
self.name = kwargs['name']
|
||||
self.comments = kwargs['comments']
|
||||
self.user_delay_samples = kwargs['user_delay_samples']
|
||||
|
||||
@@ -108,8 +108,12 @@ def parse_document(session_text: str) -> SessionDescriptor:
|
||||
|
||||
class DocParserVisitor(NodeVisitor):
|
||||
|
||||
@staticmethod
|
||||
def visit_document(_, visited_children) -> SessionDescriptor:
|
||||
def __init__(self):
|
||||
self.track_index = 0
|
||||
|
||||
# @staticmethod
|
||||
def visit_document(self, _, visited_children) -> SessionDescriptor:
|
||||
self.track_index = 0
|
||||
files = next(iter(visited_children[1]), None)
|
||||
clips = next(iter(visited_children[2]), None)
|
||||
plugins = next(iter(visited_children[3]), None)
|
||||
@@ -166,8 +170,8 @@ class DocParserVisitor(NodeVisitor):
|
||||
count_instances=child[10]),
|
||||
visited_children[2]))
|
||||
|
||||
@staticmethod
|
||||
def visit_track_block(_, visited_children):
|
||||
# @staticmethod
|
||||
def visit_track_block(self, _, visited_children):
|
||||
track_header, track_clip_list = visited_children
|
||||
clips = []
|
||||
for clip in track_clip_list:
|
||||
@@ -179,7 +183,11 @@ class DocParserVisitor(NodeVisitor):
|
||||
for plugin in plugin_opt[1]:
|
||||
plugins.append(plugin[1])
|
||||
|
||||
this_index = self.track_index
|
||||
self.track_index += 1
|
||||
|
||||
return TrackDescriptor(
|
||||
index=this_index,
|
||||
name=track_header[2],
|
||||
comments=track_header[6],
|
||||
user_delay_samples=track_header[10],
|
||||
|
||||
@@ -88,7 +88,9 @@ class TestTagCompiler(unittest.TestCase):
|
||||
state='Unmuted',
|
||||
timestamp=None),
|
||||
]
|
||||
test_track = doc_entity.TrackDescriptor(name="Track 1 [A] {Color=Red} $Mode=1",
|
||||
test_track = doc_entity.TrackDescriptor(
|
||||
index=0,
|
||||
name="Track 1 [A] {Color=Red} $Mode=1",
|
||||
comments="{Comment=This is some text in the comments}",
|
||||
user_delay_samples=0,
|
||||
plugins=[],
|
||||
|
||||
Reference in New Issue
Block a user