Skip to content

Commit

Permalink
Merge pull request #43 from iluvcapra/pt-2024.6
Browse files Browse the repository at this point in the history
PTSL 2024.6 Support
  • Loading branch information
iluvcapra authored Jul 15, 2024
2 parents df72cd0 + 82e9e95 commit 5702d75
Show file tree
Hide file tree
Showing 12 changed files with 786 additions and 383 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

![](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.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 - 3](https://img.shields.io/static/v1?label=PTSL+Version&message=3&color=0000ff)](https://github.com/iluvcapra/py-ptsl/blob/master/docs/source/ptsl_versions.rst)
[![Pro Tools Version - 2024.6](https://img.shields.io/static/v1?label=Pro+Tools+Version&message=2024.6&color=8f228f)](https://github.com/iluvcapra/py-ptsl/blob/master/docs/source/ptsl_versions.rst)
[![PTSL Version - 4](https://img.shields.io/static/v1?label=PTSL+Version&message=4&color=0000ff)](https://github.com/iluvcapra/py-ptsl/blob/master/docs/source/ptsl_versions.rst)

# py-ptsl

Expand Down
2 changes: 2 additions & 0 deletions docs/source/ptsl_versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ PTSL Versions/Pro Tools Versions
+--------------+--------------------+
| 3 | 2024.3 |
+--------------+--------------------+
| 4 | 2024.6 |
+--------------+--------------------+
19 changes: 11 additions & 8 deletions examples/session_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@
#
# ```sh
# $ python3 examples/session_info.py
# PTSL Version: 1
# Session Name: Test2
# Session Path: Macintosh HD:Users:jamie:Test2:Test2.ptx
# PTSL Version: 4
# Session Name: Test PTSL 3
# Session Path: /Volumes/Projects/Tests/Test PTSL 3/Test PTSL 3.ptx
# Session Sample Rate: 48000
# Session Audio Format: SAF_WAVE
# Session Bit Depth: Bit24
# Session Audio Interlaved: TRUE
# Session Timecode Rate: STCR_Fps2997
# Session Start Time: 01:58:00:00.00
# Session Length: 20:00:00:00
# Session feet+frames rate: SFFR_Fps23976
# Session Timecode Rate: STCR_Fps23976
# Current System Delay (fs): 0
# Session Start Time: 00:59:57:00.00
# Session Length: 24:00:00:00
# Session feet+frames rate: SFFR_Fps24
# Session Audio Rate Pull: SRP_None
# Session Video Rate Pull: SRP_None
# -------------------------------
# Transport State: TS_TransportStopped
# Transport Arm: SAFE
# Playback Modes: Normal
# Record Mode: RM_Loop
# Record Mode: 0
# ```


Expand Down Expand Up @@ -54,6 +55,8 @@
print("Session Timecode Rate: %s" %
pt.SessionTimeCodeRate.Name(engine.session_timecode_rate()))

print("Current System Delay (fs): %i" % engine.get_system_delay())

print("Session Start Time: %s" % engine.session_start_time())
print("Session Length: %s" % engine.session_length())

Expand Down
662 changes: 352 additions & 310 deletions ptsl/PTSL_pb2.py

Large diffs are not rendered by default.

234 changes: 227 additions & 7 deletions ptsl/PTSL_pb2.pyi

Large diffs are not rendered by default.

149 changes: 97 additions & 52 deletions ptsl/PTSL_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from . import PTSL_pb2 as PTSL__pb2

GRPC_GENERATED_VERSION = '1.64.1'
GRPC_VERSION = grpc.__version__
EXPECTED_ERROR_RELEASE = '1.65.0'
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
_version_not_supported = False

try:
from grpc._utilities import first_version_is_lower
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
_version_not_supported = True

if _version_not_supported:
warnings.warn(
f'The grpc package installed is at version {GRPC_VERSION},'
+ f' but the generated code in PTSL_pb2_grpc.py depends on'
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
RuntimeWarning
)


class PTSLStub(object):
"""*
Service for handling different types of ProTools commands using PTSL Client.
Service for handling different types of Pro Tools commands using PTSL Client.
"""

def __init__(self, channel):
Expand All @@ -17,20 +42,20 @@ def __init__(self, channel):
channel: A grpc.Channel.
"""
self.SendGrpcRequest = channel.unary_unary(
'/ptsl.PTSL/SendGrpcRequest',
request_serializer=PTSL__pb2.Request.SerializeToString,
response_deserializer=PTSL__pb2.Response.FromString,
)
'/ptsl.PTSL/SendGrpcRequest',
request_serializer=PTSL__pb2.Request.SerializeToString,
response_deserializer=PTSL__pb2.Response.FromString,
_registered_method=True)
self.SendGrpcStreamingRequest = channel.unary_stream(
'/ptsl.PTSL/SendGrpcStreamingRequest',
request_serializer=PTSL__pb2.Request.SerializeToString,
response_deserializer=PTSL__pb2.Response.FromString,
)
'/ptsl.PTSL/SendGrpcStreamingRequest',
request_serializer=PTSL__pb2.Request.SerializeToString,
response_deserializer=PTSL__pb2.Response.FromString,
_registered_method=True)


class PTSLServicer(object):
"""*
Service for handling different types of ProTools commands using PTSL Client.
Service for handling different types of Pro Tools commands using PTSL Client.
"""

def SendGrpcRequest(self, request, context):
Expand All @@ -52,59 +77,79 @@ def SendGrpcStreamingRequest(self, request, context):

def add_PTSLServicer_to_server(servicer, server):
rpc_method_handlers = {
'SendGrpcRequest': grpc.unary_unary_rpc_method_handler(
servicer.SendGrpcRequest,
request_deserializer=PTSL__pb2.Request.FromString,
response_serializer=PTSL__pb2.Response.SerializeToString,
),
'SendGrpcStreamingRequest': grpc.unary_stream_rpc_method_handler(
servicer.SendGrpcStreamingRequest,
request_deserializer=PTSL__pb2.Request.FromString,
response_serializer=PTSL__pb2.Response.SerializeToString,
),
'SendGrpcRequest': grpc.unary_unary_rpc_method_handler(
servicer.SendGrpcRequest,
request_deserializer=PTSL__pb2.Request.FromString,
response_serializer=PTSL__pb2.Response.SerializeToString,
),
'SendGrpcStreamingRequest': grpc.unary_stream_rpc_method_handler(
servicer.SendGrpcStreamingRequest,
request_deserializer=PTSL__pb2.Request.FromString,
response_serializer=PTSL__pb2.Response.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ptsl.PTSL', rpc_method_handlers)
'ptsl.PTSL', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))

# This class is part of an EXPERIMENTAL API.
server.add_registered_method_handlers('ptsl.PTSL', rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class PTSL(object):
"""*
Service for handling different types of ProTools commands using PTSL Client.
Service for handling different types of Pro Tools commands using PTSL Client.
"""

@staticmethod
def SendGrpcRequest(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/ptsl.PTSL/SendGrpcRequest',
PTSL__pb2.Request.SerializeToString,
PTSL__pb2.Response.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/ptsl.PTSL/SendGrpcRequest',
PTSL__pb2.Request.SerializeToString,
PTSL__pb2.Response.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def SendGrpcStreamingRequest(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/ptsl.PTSL/SendGrpcStreamingRequest',
PTSL__pb2.Request.SerializeToString,
PTSL__pb2.Response.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(
request,
target,
'/ptsl.PTSL/SendGrpcStreamingRequest',
PTSL__pb2.Request.SerializeToString,
PTSL__pb2.Response.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
2 changes: 1 addition & 1 deletion ptsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
from .engine import Engine, open_engine
from .errors import CommandError

__version__ = '301.0.0'
__version__ = '401.0.0'
4 changes: 2 additions & 2 deletions ptsl/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _prepare_operation_request_json(self, operation):
else:
request_body_json = \
json_format.MessageToJson(operation.request,
including_default_value_fields=True,
# including_default_value_fields=True,
preserving_proto_field_name=True)

self.auditor.request_json_before_cleanup(request_body_json)
Expand Down Expand Up @@ -288,7 +288,7 @@ def _primitive_register_connection(self, company_name: str,

req_json = json_format.MessageToJson(
req,
including_default_value_fields=True,
# including_default_value_fields=True,
preserving_proto_field_name=True)

response = self._send_sync_request(pt.RegisterConnection,
Expand Down
12 changes: 12 additions & 0 deletions ptsl/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,21 @@ def get_timeline_selection(self, format: TrackOffsetOptions = TimeCode
) -> Tuple[str, str]:
"""
Returns data about the current timeline selection.
:returns: a Tuple of the In and Out time.
"""
op = ops.GetTimelineSelection(time_scale=format)
self.client.run(op)

return (op.response.in_time, op.response.out_time)

def get_system_delay(self) -> int:
"""
Get the current system delay.
:returns: the delay in samples.
"""
op = ops.GetSessionSystemDelayInfo()
self.client.run(op)

return op.response.samples
2 changes: 2 additions & 0 deletions ptsl/ops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@
from .edit_tool import GetEditTool, SetEditTool
from .zoom_preset import RecallZoomPreset
from .timeline_selection import SetTimelineSelection, GetTimelineSelection

from .pt_202406_additions import GetSessionSystemDelayInfo
77 changes: 77 additions & 0 deletions ptsl/ops/pt_202406_additions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from ptsl.ops import Operation


class GetMemoryLocationsManageMode(Operation):
pass


class SetMemoryLocationsManageMode(Operation):
pass


class SetMainCounterFormat(Operation):
pass


class SetSubCounterFormat(Operation):
pass


class GetMainCounterFormat(Operation):
pass


class GetSubCounterFormat(Operation):
pass


class Undo(Operation):
pass


class Redo(Operation):
pass


class UndoAll(Operation):
pass


class RedoAll(Operation):
pass


class ClearUndoQueue(Operation):
pass


class SetTrackDSPModeSafeState(Operation):
pass


class GetSessionSystemDelayInfo(Operation):
pass


class GroupClips(Operation):
pass


class UngroupClips(Operation):
pass


class UngroupAllClips(Operation):
pass


class RegroupClips(Operation):
pass


class RepeatSelection(Operation):
pass


class DuplicateSelection(Operation):
pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ keywords = [
]
dependencies = [
'grpcio >= 1.51.1',
'protobuf == 4.25.3'
'protobuf ~= 5.26.1'
]

[tool.flit.module]
Expand Down

0 comments on commit 5702d75

Please sign in to comment.