sprocket-systems.coda.sdk 2.0.5__py3-none-any.whl → 2.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
coda/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # The versions below will be replaced automatically in CI.
2
2
  # You do not need to modify any of the versions below.
3
- __version__ = "2.0.5"
3
+ __version__ = "2.0.7"
4
4
  CODA_APP_SUITE_VERSION = "+coda-2.0.12"
5
5
  FINAL_VERSION = __version__ + CODA_APP_SUITE_VERSION
coda/sdk/constants.py CHANGED
@@ -7,8 +7,6 @@ ENV_CODA_API_TOKEN = "CODA_API_TOKEN"
7
7
  ENV_CODA_API_INSECURE_SKIP_VERIFY = "CODA_API_INSECURE_SKIP_VERIFY"
8
8
  ENV_CODA_CLI_EXE = "CODA_CLI_EXE"
9
9
  ENV_NO_CODA_EXE = "NO_CODA_EXE"
10
- ENV_S3_SRC_ROLE = "S3_SRC_ROLE"
11
- ENV_S3_SRC_EXTERNAL_ID = "S3_SRC_EXTERNAL_ID"
12
10
 
13
11
  # Default Values
14
12
  DEFAULT_API_URL = "https://v2.coda.sprocket.systems"
coda/sdk/essence.py CHANGED
@@ -219,6 +219,7 @@ class Essence:
219
219
  res["resource"]["auth"] = auth
220
220
  if opts is not None:
221
221
  res["resource"]["opts"] = opts
222
+ print(res)
222
223
  self.payload["definition"]["resources"].append(res)
223
224
 
224
225
  def override_stem_type(self, stem_type: InputStemType) -> None:
@@ -298,12 +299,13 @@ class Essence:
298
299
 
299
300
  @staticmethod
300
301
  def essences_from_files(
301
- files: List,
302
+ files: list,
302
303
  io_location_id: str | None = None,
303
- file_info: Dict | None = None,
304
+ file_info: dict | None = None,
304
305
  program: str = "",
305
- forced_frame_rate: str | None = None
306
- ) -> List["Essence"]:
306
+ forced_frame_rate: str | None = None,
307
+ no_file_scan: bool = False
308
+ ) -> list["Essence"]:
307
309
  """Create a list of CodaEssence objects from files.
308
310
 
309
311
  This method inspects local files using the 'coda inspect' command-line tool
@@ -315,19 +317,26 @@ class Essence:
315
317
  io_location_id (str, optional): The IO Location ID associated with the source files. Required for agent transfers.
316
318
  file_info (dict, optional): Manual override info for files. Required for S3.
317
319
  Should contain keys like 'format', 'type', 'frames', 's3_auth'. Defaults to None.
318
- Example: file_info = {
320
+ Examples: file_info = {
319
321
  "frames": 720000,
320
322
  "format": Format.SEVEN_ONE,
321
323
  "type": InputStemType.PRINTMASTER,
322
324
  "s3_auth": {
323
- "role": os.getenv(ENV_S3_SRC_ROLE, "XXXX"),
324
- "external_id": os.getenv(ENV_S3_SRC_EXTERNAL_ID, "XXXX"),
325
+ "iam_role": os.getenv(ENV_S3_ROLE, "XXXX"),
326
+ "iam_external_id": os.getenv(ENV_S3_EXTERNAL_ID, "XXXX"),
325
327
  },
326
328
  "s3_options": {"region": "us-west-2"},
327
329
  }
330
+
331
+ Note: `s3_auth` may also use S3 access key secret and ID
332
+ "s3_auth": {
333
+ "access_key_id": os.getenv(ENV_S3_ACCESS_KEY_ID, "XXXX"),
334
+ "secret_access_key": os.getenv(ENV_S3_SECRET_ACCESS_KEY, "XXXX"),
335
+ }
328
336
  program (str, optional): The program identifier to assign to the essences.
329
337
  Defaults to "".
330
338
  forced_frame_rate (str, optional): Specify the frame rate to calculate the FFOA and LFOA
339
+ no_file_scan (bool, optional): Do not use Coda CLI to scan files for metadata
331
340
 
332
341
  Raises:
333
342
  ValueError: If `files` is not populated with a list of file paths.
@@ -355,7 +364,7 @@ class Essence:
355
364
 
356
365
  absfiles = [str(Path(f).resolve()) for f in local_files]
357
366
  codaexe = shutil.which("coda") or os.getenv(ENV_CODA_CLI_EXE)
358
- if not codaexe or os.getenv(ENV_NO_CODA_EXE) is not None:
367
+ if not codaexe or os.getenv(ENV_NO_CODA_EXE) is not None or no_file_scan is True:
359
368
  if not file_info:
360
369
  raise ValueError("Coda CLI not found and file_info was not provided for manual creation.")
361
370
 
@@ -440,6 +449,7 @@ class Essence:
440
449
  essence = Essence(
441
450
  file_info["format"], stem_type=file_info["type"], program=program
442
451
  )
452
+
443
453
  res = [
444
454
  {
445
455
  "url": r,
coda/sdk/job.py CHANGED
@@ -214,9 +214,16 @@ class JobPayloadBuilder:
214
214
  JobPayloadBuilder: The builder instance for fluent chaining.
215
215
 
216
216
  Raises:
217
+ ValueError: If no essences have been added yet.
217
218
  ValueError: If any essence has an incompatible format.
218
219
 
219
220
  """
221
+ if not self._essences:
222
+ raise ValueError(
223
+ "Cannot force imax5. No essences have been added. "
224
+ "Call with_essences() before using this method."
225
+ )
226
+
220
227
  incompatible_formats = [
221
228
  essence.payload["definition"]["format"]
222
229
  for essence in self._essences
@@ -242,7 +249,16 @@ class JobPayloadBuilder:
242
249
  Returns:
243
250
  JobPayloadBuilder: The builder instance for fluent chaining.
244
251
 
252
+ Raises:
253
+ ValueError: If no essences have been added yet.
254
+
245
255
  """
256
+ if not self._essences:
257
+ raise ValueError(
258
+ "Cannot set input language. No essences have been added. "
259
+ "Call with_essences() before using this method."
260
+ )
261
+
246
262
  for essence in self._essences:
247
263
  essence.payload["definition"]["language"] = language.value
248
264
  return self
@@ -259,7 +275,16 @@ class JobPayloadBuilder:
259
275
  Returns:
260
276
  JobPayloadBuilder: The builder instance for fluent chaining.
261
277
 
278
+ Raises:
279
+ ValueError: If no essences have been added yet.
280
+
262
281
  """
282
+ if not self._essences:
283
+ raise ValueError(
284
+ "Cannot set program for type. No essences have been added. "
285
+ "Call with_essences() before using this method."
286
+ )
287
+
263
288
  for essence in self._essences:
264
289
  if type in essence.payload["definition"]["type"]:
265
290
  essence.payload["definition"]["program"] = program
@@ -277,7 +302,16 @@ class JobPayloadBuilder:
277
302
  Returns:
278
303
  JobPayloadBuilder: The builder instance for fluent chaining.
279
304
 
305
+ Raises:
306
+ ValueError: If no essences have been added yet.
307
+
280
308
  """
309
+ if not self._essences:
310
+ raise ValueError(
311
+ "Cannot set program for format. No essences have been added. "
312
+ "Call with_essences() before using this method."
313
+ )
314
+
281
315
  for essence in self._essences:
282
316
  if format == essence.payload["definition"]["format"]:
283
317
  essence.payload["definition"]["program"] = program
@@ -292,7 +326,16 @@ class JobPayloadBuilder:
292
326
  Returns:
293
327
  JobPayloadBuilder: The builder instance for fluent chaining.
294
328
 
329
+ Raises:
330
+ ValueError: If no essences have been added yet.
331
+
295
332
  """
333
+ if not self._essences:
334
+ raise ValueError(
335
+ "Cannot set unique program. No essences have been added. "
336
+ "Call with_essences() before using this method."
337
+ )
338
+
296
339
  for essence in self._essences:
297
340
  essence.payload["definition"]["program"] = program
298
341
  return self
@@ -318,13 +361,6 @@ class JobPayloadBuilder:
318
361
  lfoa = None
319
362
  fr = None
320
363
 
321
- for e in self._essences:
322
- essence_timing = e.payload["timing_info"]
323
- if essence_timing:
324
- ffoa = essence_timing["ffoa_timecode"]
325
- lfoa = essence_timing["lfoa_timecode"]
326
- fr = essence_timing["source_frame_rate"]
327
-
328
364
  if self._time_options.get("frame_rate"):
329
365
  fr = self._time_options.get("frame_rate")
330
366
  if self._time_options.get("ffoa"):
@@ -332,6 +368,17 @@ class JobPayloadBuilder:
332
368
  if self._time_options.get("lfoa"):
333
369
  lfoa = self._time_options.get("lfoa")
334
370
 
371
+ for e in self._essences:
372
+ current_timing = e.payload.get("timing_info") or {}
373
+ new_timing = dict(current_timing)
374
+ if not new_timing.get("ffoa_timecode"):
375
+ new_timing["ffoa_timecode"] = ffoa
376
+ if not new_timing.get("lfoa_timecode"):
377
+ new_timing["lfoa_timecode"] = lfoa
378
+ if not new_timing.get("source_frame_rate"):
379
+ new_timing["source_frame_rate"] = fr
380
+ e.payload["timing_info"] = new_timing
381
+
335
382
  sources = [e.dict() for e in self._essences]
336
383
 
337
384
  start_time = self._time_options.get("start_time")
coda/sdk/preset.py CHANGED
@@ -168,7 +168,7 @@ class Preset:
168
168
 
169
169
  @staticmethod
170
170
  def get_io_location_id_by_name(io_location_name: str) -> str:
171
- """Get an IO Location ID by its name.
171
+ """Get an IO Location ID by its name. Requires Org Admin/Owner API token.
172
172
 
173
173
  Args:
174
174
  io_location_name (str): The name of the IO location to search for.
@@ -213,3 +213,27 @@ class Preset:
213
213
  raise ValueError(f"Multiple workflows found with name '{workflow_name}': {[w['id'] for w in matches]}")
214
214
 
215
215
  return matches[0]
216
+
217
+ @staticmethod
218
+ def get_naming_convention_by_name(naming_convention_name: str) -> dict:
219
+ """Get a naming convention by its name.
220
+
221
+ Args:
222
+ naming_convention_name (str): The name of the naming convention to search for.
223
+
224
+ Returns:
225
+ dict: The complete naming_convention object.
226
+
227
+ Raises:
228
+ ValueError: If no naming convention with the given name is found, or if multiple match.
229
+
230
+ """
231
+ naming_conventions = Preset.get_presets(PresetType.NAMING)
232
+ matches = [n for n in naming_conventions if n["name"] == naming_convention_name]
233
+
234
+ if len(matches) == 0:
235
+ raise ValueError(f"No naming convention found with name '{naming_convention_name}'")
236
+ if len(matches) > 1:
237
+ raise ValueError(f"Multiple naming conventions found with name '{naming_convention_name}': {[n['id'] for n in matches]}")
238
+
239
+ return matches[0]["convention_data"]
coda/sdk/workflow.py CHANGED
@@ -995,7 +995,10 @@ class WorkflowDefinitionBuilder:
995
995
  venues = []
996
996
  for block_id in blist:
997
997
  block = self._process_blocks[block_id]
998
- venues.append(block["output_settings"]["venue"])
998
+ venue_type = block.get("output_settings").get("venue")
999
+ venue = self._ALL_FROM_ESSENCE if venue_type == self._SAME_AS_INPUT else venue_type
1000
+ venues.append(venue)
1001
+
999
1002
  for fr_original in output_frame_rates:
1000
1003
  for f_original in output_formats:
1001
1004
  for t_original in output_stem_types:
@@ -1078,7 +1081,10 @@ class WorkflowDefinitionBuilder:
1078
1081
 
1079
1082
  for block_id in blist:
1080
1083
  block = self._process_blocks[block_id]
1081
- venues.append(block["output_settings"]["venue"])
1084
+ venue_type = block.get("output_settings").get("venue")
1085
+ venue = self._ALL_FROM_ESSENCE if venue_type == self._SAME_AS_INPUT else venue_type
1086
+ venues.append(venue)
1087
+
1082
1088
  fmt = Format.ATMOS
1083
1089
  fr = self._SAME_AS_INPUT if output_frame_rate == self._ALL_FROM_ESSENCE else output_frame_rate
1084
1090
  st = self._SAME_AS_INPUT if output_stem_type == self._ALL_FROM_ESSENCE else output_stem_type
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sprocket-systems.coda.sdk
3
- Version: 2.0.5
3
+ Version: 2.0.7
4
4
  Summary: The Coda SDK provides a Python interface to define Coda workflows, create jobs and run them.
5
5
  Keywords: python,coda,sdk
6
6
  Author-Email: Sprocket Systems <support@sprocket.systems>
@@ -9,13 +9,10 @@ License-File: LICENSE
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
17
14
  Project-URL: Documentation, https://v2.coda.sprocket.systems/docs/sdks/python/
18
- Requires-Python: >=3.7
15
+ Requires-Python: >=3.11
19
16
  Requires-Dist: requests
20
17
  Requires-Dist: soundfile>=0.13.1
21
18
  Description-Content-Type: text/markdown
@@ -0,0 +1,15 @@
1
+ coda/__init__.py,sha256=Yh8vyckIapgq2CptJp72Gm6OgtnxtzocwjzOIrof1X8,229
2
+ coda/sdk/__init__.py,sha256=wOCrh1piLbgLVOMhKuLFYA62n60IN89eXGHpFKwFAE4,691
3
+ coda/sdk/constants.py,sha256=DW-goGI4vTlt8KeR4z0sf89Duov4TgZdsjv1VJDuAQI,596
4
+ coda/sdk/enums.py,sha256=1l4pK8pNofV56WVAiQXitlY6m9iTfEv9I159GWkTZKE,6582
5
+ coda/sdk/essence.py,sha256=vSx2lp1I0yJvFNMcAWqF-I3BV9q_bRnZbtSEf_QArHg,20764
6
+ coda/sdk/job.py,sha256=WArS06ufJUZLDdx6wJHgwk2olYjtX3w_sJqPF_XEu6A,21538
7
+ coda/sdk/preset.py,sha256=OtaRVJU6luBBD_6Ehd8ZkcjXL_YVoXfziI14E-GS4Xw,8934
8
+ coda/sdk/utils.py,sha256=uC9hHJtMkGu3pLvJOwq9kIdf6r7KxMRAbzaRyf95EdQ,10565
9
+ coda/sdk/workflow.py,sha256=QpGvjkNuFKh5XyawC7HXyx-nmC4EKbdRc-6eIjaQ79Q,63171
10
+ coda/tc_tools.py,sha256=hEtVE6xtPqg93WfJ-lQdRQroPdQTkH5HkMLWCIkwIlo,22010
11
+ sprocket_systems_coda_sdk-2.0.7.dist-info/METADATA,sha256=DJRra7QdThUQVFDJZiQxWmy4X11iq6gu_SZNlrVPcaw,1106
12
+ sprocket_systems_coda_sdk-2.0.7.dist-info/WHEEL,sha256=tsUv_t7BDeJeRHaSrczbGeuK-TtDpGsWi_JfpzD255I,90
13
+ sprocket_systems_coda_sdk-2.0.7.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
14
+ sprocket_systems_coda_sdk-2.0.7.dist-info/licenses/LICENSE,sha256=wrFjizFlraIAPW8JIteGftNH2laAZBBRhdEnPVUsKTM,10198
15
+ sprocket_systems_coda_sdk-2.0.7.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- coda/__init__.py,sha256=A5O6J7ACQsUK8TvmgzsxIrWX_dYll0VQGuGAuI7X5FE,229
2
- coda/sdk/__init__.py,sha256=wOCrh1piLbgLVOMhKuLFYA62n60IN89eXGHpFKwFAE4,691
3
- coda/sdk/constants.py,sha256=HRWf8zE8IFVRy-2apsae4BSecXod3BsQiozaMkJkY88,674
4
- coda/sdk/enums.py,sha256=1l4pK8pNofV56WVAiQXitlY6m9iTfEv9I159GWkTZKE,6582
5
- coda/sdk/essence.py,sha256=sv4ge8d--cTzXj0Qp7tHOn3skUIhV_KIej3v2kB2XvE,20264
6
- coda/sdk/job.py,sha256=7wV9-y9Xvi8QN9BJ3AtugMj-CQqH226DYf_GXLe-Ucw,19868
7
- coda/sdk/preset.py,sha256=93IKUSSEWe-E-jOOdM_TxJveICc3aKD8fY8_avg1Gbw,7951
8
- coda/sdk/utils.py,sha256=uC9hHJtMkGu3pLvJOwq9kIdf6r7KxMRAbzaRyf95EdQ,10565
9
- coda/sdk/workflow.py,sha256=4-r3hWUEabyzS1vA0Ql-1VY5FoQA3KNnWlhwqQ0umbw,62899
10
- coda/tc_tools.py,sha256=hEtVE6xtPqg93WfJ-lQdRQroPdQTkH5HkMLWCIkwIlo,22010
11
- sprocket_systems_coda_sdk-2.0.5.dist-info/METADATA,sha256=ha_aEO7RaRRntAQYzBsLVf1geHXvFoVfcso8mB6Vyvc,1252
12
- sprocket_systems_coda_sdk-2.0.5.dist-info/WHEEL,sha256=tsUv_t7BDeJeRHaSrczbGeuK-TtDpGsWi_JfpzD255I,90
13
- sprocket_systems_coda_sdk-2.0.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
14
- sprocket_systems_coda_sdk-2.0.5.dist-info/licenses/LICENSE,sha256=wrFjizFlraIAPW8JIteGftNH2laAZBBRhdEnPVUsKTM,10198
15
- sprocket_systems_coda_sdk-2.0.5.dist-info/RECORD,,