10 Commits

Author SHA1 Message Date
Jamie Hardt
17b87b6e69 Update __init__.py
Nudged version
2023-07-27 23:23:39 -07:00
Jamie Hardt
a636791539 Autopep 2023-07-27 23:17:23 -07:00
Jamie Hardt
dfde3c4493 Fixed errors with track_index field
In tests
2023-07-27 23:15:49 -07:00
Jamie Hardt
81909c8a51 Added track index to TrackDescriptor
to indicate a track's import order.
2023-07-27 22:58:06 -07:00
Jamie Hardt
e2b9a20870 Added some documentation 2023-07-27 22:10:29 -07:00
Jamie Hardt
006cec05e5 Merge pull request #10 from iluvcapra/bug-flake8
Flake8 code cleanups and a bug fix
2023-07-22 13:01:15 -07:00
Jamie Hardt
a95f0b5cca Nudged version number 2023-07-22 12:58:32 -07:00
Jamie Hardt
70a5206d73 Fixed dumb typo that made ptsl break 2023-07-21 22:21:48 -07:00
Jamie Hardt
128eed002d Update README.md 2023-07-21 14:54:54 -07:00
Jamie Hardt
f8a0d70942 Update README.md
Dumb typo in "last commit" badge
2023-07-21 14:54:23 -07:00
6 changed files with 31 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
![](https://img.shields.io/github/license/iluvcapra/ptulsconv.svg) ![](https://img.shields.io/github/license/iluvcapra/ptulsconv.svg)
![](https://img.shields.io/pypi/pyversions/ptulsconv.svg) ![](https://img.shields.io/pypi/pyversions/ptulsconv.svg)
[![](https://img.shields.io/pypi/v/ptulsconv.svg)][pypi] [![](https://img.shields.io/pypi/v/ptulsconv.svg)][pypi]
![GitHub last commit](https://img.shields.io/github/last-commit/iluvcapra/pycmx) ![GitHub last commit](https://img.shields.io/github/last-commit/iluvcapra/ptulsconv)
[![Lint and Test](https://github.com/iluvcapra/ptulsconv/actions/workflows/python-package.yml/badge.svg)](https://github.com/iluvcapra/ptulsconv/actions/workflows/python-package.yml) [![Lint and Test](https://github.com/iluvcapra/ptulsconv/actions/workflows/python-package.yml/badge.svg)](https://github.com/iluvcapra/ptulsconv/actions/workflows/python-package.yml)
[pypi]: https://pypi.org/project/ptulsconv/ [pypi]: https://pypi.org/project/ptulsconv/
@@ -10,7 +10,7 @@
# ptulsconv # 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 ## Quick Start

View File

@@ -2,7 +2,7 @@
Parse and convert Pro Tools text exports Parse and convert Pro Tools text exports
""" """
__version__ = '2.0.0' __version__ = '2.1.0'
__author__ = 'Jamie Hardt' __author__ = 'Jamie Hardt'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = "%s %s (c) 2023 %s. All rights reserved." \ __copyright__ = "%s %s (c) 2023 %s. All rights reserved." \

View File

@@ -187,7 +187,7 @@ def convert(major_mode, input_file=None, output=sys.stdout, warnings=True):
req.time_type("tc") req.time_type("tc")
req.dont_show_crossfades() req.dont_show_crossfades()
req.selected_tracks_only() req.selected_tracks_only()
session_text = req.export_string session_text = req.export_string()
session = parse_document(session_text) session = parse_document(session_text)
session_tc_format = session.header.timecode_format session_tc_format = session.header.timecode_format

View File

@@ -20,6 +20,9 @@ class SessionDescriptor:
self.markers = kwargs['markers'] self.markers = kwargs['markers']
def markers_timed(self) -> Iterator[Tuple['MarkerDescriptor', Fraction]]: def markers_timed(self) -> Iterator[Tuple['MarkerDescriptor', Fraction]]:
"""
Iterate each marker in the session with its respective time reference.
"""
for marker in self.markers: for marker in self.markers:
marker_time = Fraction(marker.time_reference, marker_time = Fraction(marker.time_reference,
int(self.header.sample_rate)) int(self.header.sample_rate))
@@ -28,6 +31,9 @@ class SessionDescriptor:
def tracks_clips(self) -> Iterator[Tuple['TrackDescriptor', def tracks_clips(self) -> Iterator[Tuple['TrackDescriptor',
'TrackClipDescriptor']]: 'TrackClipDescriptor']]:
"""
Iterate each track clip with its respective owning clip.
"""
for track in self.tracks: for track in self.tracks:
for clip in track.clips: for clip in track.clips:
yield track, clip yield track, clip
@@ -37,7 +43,10 @@ class SessionDescriptor:
Fraction, Fraction, Fraction] 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 and timestamp
""" """
for track, clip in self.tracks_clips(): for track, clip in self.tracks_clips():
@@ -115,6 +124,7 @@ class HeaderDescriptor:
class TrackDescriptor: class TrackDescriptor:
index: int
name: str name: str
comments: str comments: str
user_delay_samples: int user_delay_samples: int
@@ -123,6 +133,7 @@ class TrackDescriptor:
clips: List["TrackClipDescriptor"] clips: List["TrackClipDescriptor"]
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.index = kwargs['index']
self.name = kwargs['name'] self.name = kwargs['name']
self.comments = kwargs['comments'] self.comments = kwargs['comments']
self.user_delay_samples = kwargs['user_delay_samples'] self.user_delay_samples = kwargs['user_delay_samples']

View File

@@ -108,8 +108,12 @@ def parse_document(session_text: str) -> SessionDescriptor:
class DocParserVisitor(NodeVisitor): class DocParserVisitor(NodeVisitor):
@staticmethod def __init__(self):
def visit_document(_, visited_children) -> SessionDescriptor: self.track_index = 0
# @staticmethod
def visit_document(self, _, visited_children) -> SessionDescriptor:
self.track_index = 0
files = next(iter(visited_children[1]), None) files = next(iter(visited_children[1]), None)
clips = next(iter(visited_children[2]), None) clips = next(iter(visited_children[2]), None)
plugins = next(iter(visited_children[3]), None) plugins = next(iter(visited_children[3]), None)
@@ -166,8 +170,8 @@ class DocParserVisitor(NodeVisitor):
count_instances=child[10]), count_instances=child[10]),
visited_children[2])) visited_children[2]))
@staticmethod # @staticmethod
def visit_track_block(_, visited_children): def visit_track_block(self, _, visited_children):
track_header, track_clip_list = visited_children track_header, track_clip_list = visited_children
clips = [] clips = []
for clip in track_clip_list: for clip in track_clip_list:
@@ -179,7 +183,11 @@ class DocParserVisitor(NodeVisitor):
for plugin in plugin_opt[1]: for plugin in plugin_opt[1]:
plugins.append(plugin[1]) plugins.append(plugin[1])
this_index = self.track_index
self.track_index += 1
return TrackDescriptor( return TrackDescriptor(
index=this_index,
name=track_header[2], name=track_header[2],
comments=track_header[6], comments=track_header[6],
user_delay_samples=track_header[10], user_delay_samples=track_header[10],

View File

@@ -88,7 +88,9 @@ class TestTagCompiler(unittest.TestCase):
state='Unmuted', state='Unmuted',
timestamp=None), 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}", comments="{Comment=This is some text in the comments}",
user_delay_samples=0, user_delay_samples=0,
plugins=[], plugins=[],