Skip to content

Commit

Permalink
Merge pull request #29 from iluvcapra/noerw/master
Browse files Browse the repository at this point in the history
Noerw/master
  • Loading branch information
iluvcapra authored Apr 11, 2024
2 parents 50d0651 + b5cda96 commit 074d117
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

![](https://img.shields.io/pypi/pyversions/py-ptsl.svg) [![](https://img.shields.io/pypi/v/py-ptsl.svg)](https://pypi.org/project/py-ptsl/) ![](https://img.shields.io/pypi/wheel/py-ptsl.svg)

[![Pro Tools Version - 2023.6](https://img.shields.io/static/v1?label=Pro+Tools+Version&message=2023.6&color=8f228f)](https://github.com/iluvcapra/py-ptsl/blob/master/docs/source/ptsl_versions.rst)
[![Pro Tools Version - 2023.9](https://img.shields.io/static/v1?label=Pro+Tools+Version&message=2023.9&color=8f228f)](https://github.com/iluvcapra/py-ptsl/blob/master/docs/source/ptsl_versions.rst)
[![PTSL Version - 1](https://img.shields.io/static/v1?label=PTSL+Version&message=1&color=0000ff)](https://github.com/iluvcapra/py-ptsl/blob/master/docs/source/ptsl_versions.rst)

# py-ptsl
Expand Down
1 change: 1 addition & 0 deletions docs/source/ptsl_versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ PTSL Versions/Pro Tools Versions
| 1 | 2022.12 |
| | 2023.3 |
| | 2023.6 |
| | 2023.9 |
+--------------+--------------------+
2 changes: 1 addition & 1 deletion ptsl/PTSL_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ptsl/PTSL_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2623,4 +2623,4 @@ class GetSessionIDsResponseBody(_message.Message):
origin_id: str
instance_id: str
parent_id: str
def __init__(self, origin_id: _Optional[str] = ..., instance_id: _Optional[str] = ..., parent_id: _Optional[str] = ...) -> None: ...
def __init__(self, origin_id: _Optional[str] = ..., instance_id: _Optional[str] = ..., parent_id: _Optional[str] = ...) -> None: ...
59 changes: 58 additions & 1 deletion ptsl/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
PasteSpecialOptions, TrackOffsetOptions, TrackListInvertibleFilter, \
ExportFileType, ResolveDuplicateNamesBy, ExportFormat, \
MemoryLocationReference, MemoryLocationProperties, \
TimeProperties, CL_ClipLocation
TimeProperties, CL_ClipLocation, SelectionMode


@contextmanager
Expand Down Expand Up @@ -824,7 +824,64 @@ def refresh_target_audio_files(self, files: List[str]):
self.client.run(op)

def refresh_all_modified_audio_flles(self):
"""
Deprecated: use refresh_all_modified_audio_files() instead
"""
self.refresh_all_modified_audio_files()

def refresh_all_modified_audio_files(self):
"""
Refreshes all modified audio files.
"""
self.client.run(ops.RefreshAllModifiedAudioFiles())

# PT 2023.9
# TODO add remaining new methods, add proper docstrings, expose
# remaining parameters
# CreateNewTracks
# GetEditMode, SetEditMode, GetEditModeOptions, SetEditModeOptions
# GetEditTool, SetEditTool
# RecallZoomPreset

def select_tracks_by_name(self, names: List[str],
mode: Optional['SelectionMode'] = pt.SM_Replace):
"""
Selects all tracks matching any of the passed names literally.
"""
# TODO: handle pagination request?
op = ops.SelectTracksByName(track_names=names, selection_mode=mode)
self.client.run(op)

def set_timeline_selection(self, start: str, end: str,
playhead_time: Optional[str]):
"""
Sets temporal selection range
"""
# TODO expose remaining arguments
# string pre_roll_start_time = 4
# string post_roll_stop_time = 5
# TripleBool pre_roll_enabled = 6
# TripleBool post_roll_enabled = 7
# TimelineUpdateVideo update_video_to = 8
# TripleBool propagate_to_satellites = 9

if playhead_time is None:
playhead_time = start

self.client.run(ops.SetTimelineSelection(
play_start_marker_time=playhead_time,
in_time=start,
out_time=end,
pre_roll_start_time=start,
post_roll_stop_time=end,
update_video_to=pt.TUV_None,
))

def get_timeline_selection(self) -> pt.GetTimelineSelectionResponseBody:
"""
Returns data about the current temporal selection, including
pre/post-roll settings.
"""
op = ops.GetMemoryLocations()
self.client.run(op)
return op.response
10 changes: 10 additions & 0 deletions ptsl/ops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@
PlayHalfSpeed, RecordHalfSpeed

from .memory_locations import EditMemoryLocation, GetMemoryLocations

# Pro Tools 2023.9

from .create_new_tracks import CreateNewTracks
from .select_tracks import SelectTracksByName
from .edit_mode import GetEditMode, SetEditMode, GetEditModeOptions, \
SetEditModeOptions
from .edit_tool import GetEditTool, SetEditTool
from .zoom_preset import RecallZoomPreset
from .timeline_selection import SetTimelineSelection, GetTimelineSelection
5 changes: 5 additions & 0 deletions ptsl/ops/create_new_tracks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ptsl.ops import Operation


class CreateNewTracks(Operation):
pass
17 changes: 17 additions & 0 deletions ptsl/ops/edit_mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from ptsl.ops import Operation


class GetEditMode(Operation):
pass


class SetEditMode(Operation):
pass


class GetEditModeOptions(Operation):
pass


class SetEditModeOptions(Operation):
pass
9 changes: 9 additions & 0 deletions ptsl/ops/edit_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ptsl.ops import Operation


class GetEditTool(Operation):
pass


class SetEditTool(Operation):
pass
5 changes: 5 additions & 0 deletions ptsl/ops/select_tracks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ptsl.ops import Operation


class SelectTracksByName(Operation):
pass
9 changes: 9 additions & 0 deletions ptsl/ops/timeline_selection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ptsl.ops import Operation


class GetTimelineSelection(Operation):
pass


class SetTimelineSelection(Operation):
pass
5 changes: 5 additions & 0 deletions ptsl/ops/zoom_preset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ptsl.ops import Operation


class RecallZoomPreset(Operation):
pass

0 comments on commit 074d117

Please sign in to comment.