Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iluvcapra authored Apr 11, 2024
2 parents 3e0f158 + 074d117 commit 711531c
Show file tree
Hide file tree
Showing 16 changed files with 609 additions and 458 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 |
+--------------+--------------------+
11 changes: 11 additions & 0 deletions examples/spot_sound.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

import ptsl
from ptsl import open_engine
# from ptsl.PTSL_pb2 import PT_NoOpenedSession
# import ptsl.PTSL_pb2 as pt

with open_engine(application_name=sys.argv[0],
company_name=ptsl.__name__) as engine:

pass
762 changes: 382 additions & 380 deletions ptsl/PTSL_pb2.py

Large diffs are not rendered by default.

44 changes: 38 additions & 6 deletions ptsl/PTSL_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class CommandId(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
SetTrackFrozenState: _ClassVar[CommandId]
SetTrackOnlineState: _ClassVar[CommandId]
SetTrackOpenState: _ClassVar[CommandId]
GetSessionIDs: _ClassVar[CommandId]

class TaskStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
__slots__ = ()
Expand Down Expand Up @@ -241,12 +242,16 @@ class TrackFormat(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
TF_5thOrderAmbisonics: _ClassVar[TrackFormat]
TF_6thOrderAmbisonics: _ClassVar[TrackFormat]
TF_7thOrderAmbisonics: _ClassVar[TrackFormat]
TF_None: _ClassVar[TrackFormat]
TF_2_1: _ClassVar[TrackFormat]
TF_Overhead: _ClassVar[TrackFormat]

class TrackTimebase(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
__slots__ = ()
TTB_Unknown: _ClassVar[TrackTimebase]
TTB_Samples: _ClassVar[TrackTimebase]
TTB_Ticks: _ClassVar[TrackTimebase]
TTB_None: _ClassVar[TrackTimebase]

class TrackAttributeState(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
__slots__ = ()
Expand Down Expand Up @@ -796,6 +801,7 @@ SetTrackInactiveState: CommandId
SetTrackFrozenState: CommandId
SetTrackOnlineState: CommandId
SetTrackOpenState: CommandId
GetSessionIDs: CommandId
Queued: TaskStatus
Pending: TaskStatus
InProgress: TaskStatus
Expand Down Expand Up @@ -921,9 +927,13 @@ TF_4thOrderAmbisonics: TrackFormat
TF_5thOrderAmbisonics: TrackFormat
TF_6thOrderAmbisonics: TrackFormat
TF_7thOrderAmbisonics: TrackFormat
TF_None: TrackFormat
TF_2_1: TrackFormat
TF_Overhead: TrackFormat
TTB_Unknown: TrackTimebase
TTB_Samples: TrackTimebase
TTB_Ticks: TrackTimebase
TTB_None: TrackTimebase
None: TrackAttributeState
SetExplicitly: TrackAttributeState
SetImplicitly: TrackAttributeState
Expand Down Expand Up @@ -1304,7 +1314,7 @@ class PaginationResponse(_message.Message):
def __init__(self, total: _Optional[int] = ..., limit: _Optional[int] = ..., offset: _Optional[int] = ...) -> None: ...

class TrackAttributes(_message.Message):
__slots__ = ("is_inactive", "is_hidden", "is_selected", "contains_clips", "contains_automation", "is_soloed", "is_record_enabled", "is_input_monitoring_on", "is_smart_dsp_on", "is_locked", "is_muted", "is_frozen", "is_open", "is_online")
__slots__ = ("is_inactive", "is_hidden", "is_selected", "contains_clips", "contains_automation", "is_soloed", "is_record_enabled", "is_input_monitoring_on", "is_smart_dsp_on", "is_locked", "is_muted", "is_frozen", "is_open", "is_online", "is_record_enabled_safe", "is_smart_dsp_on_safe", "is_soloed_safe")
IS_INACTIVE_FIELD_NUMBER: _ClassVar[int]
IS_HIDDEN_FIELD_NUMBER: _ClassVar[int]
IS_SELECTED_FIELD_NUMBER: _ClassVar[int]
Expand All @@ -1319,6 +1329,9 @@ class TrackAttributes(_message.Message):
IS_FROZEN_FIELD_NUMBER: _ClassVar[int]
IS_OPEN_FIELD_NUMBER: _ClassVar[int]
IS_ONLINE_FIELD_NUMBER: _ClassVar[int]
IS_RECORD_ENABLED_SAFE_FIELD_NUMBER: _ClassVar[int]
IS_SMART_DSP_ON_SAFE_FIELD_NUMBER: _ClassVar[int]
IS_SOLOED_SAFE_FIELD_NUMBER: _ClassVar[int]
is_inactive: TrackAttributeState
is_hidden: TrackAttributeState
is_selected: TrackAttributeState
Expand All @@ -1333,25 +1346,32 @@ class TrackAttributes(_message.Message):
is_frozen: bool
is_open: bool
is_online: bool
def __init__(self, is_inactive: _Optional[_Union[TrackAttributeState, str]] = ..., is_hidden: _Optional[_Union[TrackAttributeState, str]] = ..., is_selected: _Optional[_Union[TrackAttributeState, str]] = ..., contains_clips: bool = ..., contains_automation: bool = ..., is_soloed: bool = ..., is_record_enabled: bool = ..., is_input_monitoring_on: _Optional[_Union[TrackAttributeState, str]] = ..., is_smart_dsp_on: bool = ..., is_locked: bool = ..., is_muted: bool = ..., is_frozen: bool = ..., is_open: bool = ..., is_online: bool = ...) -> None: ...
is_record_enabled_safe: bool
is_smart_dsp_on_safe: bool
is_soloed_safe: bool
def __init__(self, is_inactive: _Optional[_Union[TrackAttributeState, str]] = ..., is_hidden: _Optional[_Union[TrackAttributeState, str]] = ..., is_selected: _Optional[_Union[TrackAttributeState, str]] = ..., contains_clips: bool = ..., contains_automation: bool = ..., is_soloed: bool = ..., is_record_enabled: bool = ..., is_input_monitoring_on: _Optional[_Union[TrackAttributeState, str]] = ..., is_smart_dsp_on: bool = ..., is_locked: bool = ..., is_muted: bool = ..., is_frozen: bool = ..., is_open: bool = ..., is_online: bool = ..., is_record_enabled_safe: bool = ..., is_smart_dsp_on_safe: bool = ..., is_soloed_safe: bool = ...) -> None: ...

class Track(_message.Message):
__slots__ = ("name", "type", "id", "index", "color", "track_attributes", "id_compressed")
__slots__ = ("name", "type", "id", "index", "color", "track_attributes", "id_compressed", "format", "timebase")
NAME_FIELD_NUMBER: _ClassVar[int]
TYPE_FIELD_NUMBER: _ClassVar[int]
ID_FIELD_NUMBER: _ClassVar[int]
INDEX_FIELD_NUMBER: _ClassVar[int]
COLOR_FIELD_NUMBER: _ClassVar[int]
TRACK_ATTRIBUTES_FIELD_NUMBER: _ClassVar[int]
ID_COMPRESSED_FIELD_NUMBER: _ClassVar[int]
FORMAT_FIELD_NUMBER: _ClassVar[int]
TIMEBASE_FIELD_NUMBER: _ClassVar[int]
name: str
type: TrackType
id: str
index: int
color: str
track_attributes: TrackAttributes
id_compressed: str
def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[TrackType, str]] = ..., id: _Optional[str] = ..., index: _Optional[int] = ..., color: _Optional[str] = ..., track_attributes: _Optional[_Union[TrackAttributes, _Mapping]] = ..., id_compressed: _Optional[str] = ...) -> None: ...
format: TrackFormat
timebase: TrackTimebase
def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[TrackType, str]] = ..., id: _Optional[str] = ..., index: _Optional[int] = ..., color: _Optional[str] = ..., track_attributes: _Optional[_Union[TrackAttributes, _Mapping]] = ..., id_compressed: _Optional[str] = ..., format: _Optional[_Union[TrackFormat, str]] = ..., timebase: _Optional[_Union[TrackTimebase, str]] = ...) -> None: ...

class GetTaskStatusRequestBody(_message.Message):
__slots__ = ("task_id",)
Expand Down Expand Up @@ -1588,20 +1608,22 @@ class RenameTargetTrackRequestBody(_message.Message):
def __init__(self, track_id: _Optional[str] = ..., new_name: _Optional[str] = ..., current_name: _Optional[str] = ...) -> None: ...

class ExportClipsAsFilesRequestBody(_message.Message):
__slots__ = ("file_path", "format", "file_type", "bit_depth", "duplicate_names", "enforce_avid_compatibility")
__slots__ = ("file_path", "format", "file_type", "bit_depth", "duplicate_names", "enforce_avid_compatibility", "sample_rate_custom")
FILE_PATH_FIELD_NUMBER: _ClassVar[int]
FORMAT_FIELD_NUMBER: _ClassVar[int]
FILE_TYPE_FIELD_NUMBER: _ClassVar[int]
BIT_DEPTH_FIELD_NUMBER: _ClassVar[int]
DUPLICATE_NAMES_FIELD_NUMBER: _ClassVar[int]
ENFORCE_AVID_COMPATIBILITY_FIELD_NUMBER: _ClassVar[int]
SAMPLE_RATE_CUSTOM_FIELD_NUMBER: _ClassVar[int]
file_path: str
format: ExportFormat
file_type: ExportFileType
bit_depth: BitDepth
duplicate_names: ResolveDuplicateNamesBy
enforce_avid_compatibility: bool
def __init__(self, file_path: _Optional[str] = ..., format: _Optional[_Union[ExportFormat, str]] = ..., file_type: _Optional[_Union[ExportFileType, str]] = ..., bit_depth: _Optional[_Union[BitDepth, str]] = ..., duplicate_names: _Optional[_Union[ResolveDuplicateNamesBy, str]] = ..., enforce_avid_compatibility: bool = ...) -> None: ...
sample_rate_custom: int
def __init__(self, file_path: _Optional[str] = ..., format: _Optional[_Union[ExportFormat, str]] = ..., file_type: _Optional[_Union[ExportFileType, str]] = ..., bit_depth: _Optional[_Union[BitDepth, str]] = ..., duplicate_names: _Optional[_Union[ResolveDuplicateNamesBy, str]] = ..., enforce_avid_compatibility: bool = ..., sample_rate_custom: _Optional[int] = ...) -> None: ...

class ExportSelectedTracksAsAAFOMFRequestBody(_message.Message):
__slots__ = ("file_type", "bit_depth", "copy_option", "enforce_media_composer_compatibility", "quantize_edits_to_frame_boundaries", "export_stereo_as_multichannel", "container_file_name", "container_file_location", "asset_file_location", "comments", "sequence_name")
Expand Down Expand Up @@ -2592,3 +2614,13 @@ class SetTrackOpenStateRequestBody(_message.Message):
track_names: _containers.RepeatedScalarFieldContainer[str]
enabled: bool
def __init__(self, track_names: _Optional[_Iterable[str]] = ..., enabled: bool = ...) -> None: ...

class GetSessionIDsResponseBody(_message.Message):
__slots__ = ("origin_id", "instance_id", "parent_id")
ORIGIN_ID_FIELD_NUMBER: _ClassVar[int]
INSTANCE_ID_FIELD_NUMBER: _ClassVar[int]
PARENT_ID_FIELD_NUMBER: _ClassVar[int]
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: ...
93 changes: 47 additions & 46 deletions ptsl/PTSL_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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,
)
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,
)


class PTSLServicer(object):
Expand All @@ -52,58 +52,59 @@ 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.


class PTSL(object):
"""*
Service for handling different types of ProTools 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):
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)
PTSL__pb2.Request.SerializeToString,
PTSL__pb2.Response.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def SendGrpcStreamingRequest(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
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)
PTSL__pb2.Request.SerializeToString,
PTSL__pb2.Response.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
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__ = '101.1.0'
__version__ = '301.0.0'
16 changes: 9 additions & 7 deletions ptsl/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ptsl.ops import Operation


PTSL_VERSION = 1
PTSL_VERSION = 3


@contextmanager
Expand Down Expand Up @@ -153,11 +153,12 @@ def run(self, operation: Operation) -> None:
operation.status = response.header.status

if response.header.status == pt.Failed:
cleaned_response_error_json = self._response_error_json_cleanup(
response.response_error_json)
command_error = json_format.Parse(cleaned_response_error_json,
pt.CommandError())
raise CommandError(command_error)
cleaned_response_error_json = response.response_error_json
# self._response_error_json_cleanup(
# response.response_error_json)
command_errors = json_format.Parse(cleaned_response_error_json,
pt.ResponseError())
raise CommandError(command_errors.errors)

elif response.header.status == pt.Completed:
self._handle_completed_response(operation, response)
Expand All @@ -180,7 +181,6 @@ def _prepare_operation_request_json(self, operation):
else:
request_body_json = \
json_format.MessageToJson(operation.request,
including_default_value_fields=True,
preserving_proto_field_name=True)

self.auditor.request_json_before_cleanup(request_body_json)
Expand All @@ -196,9 +196,11 @@ def _response_error_json_cleanup(self, json_in: str) -> str:
(for instance, if the server returns a symbold name or numeric string
value, as it sometimes has done in the past. (See `errata`).
"""

errors = json.loads(json_in)
error_dict = errors['errors'][0]
old_val = errors['errors'][0]['command_error_type']

if isinstance(old_val, str):
if old_val.isdigit():
error_dict['command_error_type'] = int(old_val)
Expand Down
Loading

0 comments on commit 711531c

Please sign in to comment.