Skip to content

Commit

Permalink
Remove Plugin schema execution_scope parameter (#1428)
Browse files Browse the repository at this point in the history
* remove execution_scope from OTIO
* add type hints to media linker code samples

Co-authored-by: ssteinbach <[email protected]>
  • Loading branch information
ssteinbach and ssteinbach authored Sep 30, 2022
1 parent 170dae2 commit 531edf5
Show file tree
Hide file tree
Showing 26 changed files with 19 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,54 @@
{
"OTIO_SCHEMA": "Adapter.1",
"name": "fcpx_xml",
"execution_scope": "in process",
"filepath": "fcpx_xml.py",
"suffixes": ["fcpxml"]
},
{
"OTIO_SCHEMA": "Adapter.1",
"name": "hls_playlist",
"execution_scope": "in process",
"filepath": "hls_playlist.py",
"suffixes": ["m3u8"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "rv_session",
"execution_scope" : "in process",
"filepath" : "rv.py",
"suffixes" : ["rv"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "maya_sequencer",
"execution_scope" : "in process",
"filepath" : "maya_sequencer.py",
"suffixes" : ["ma","mb"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "ale",
"execution_scope" : "in process",
"filepath" : "ale.py",
"suffixes" : ["ale"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "burnins",
"execution_scope" : "in process",
"filepath" : "burnins.py",
"suffixes" : []
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "AAF",
"execution_scope" : "in process",
"filepath" : "advanced_authoring_format.py",
"suffixes" : ["aaf"]
},
{
"OTIO_SCHEMA": "Adapter.1",
"name": "xges",
"execution_scope": "in process",
"filepath": "xges.py",
"suffixes": ["xges"]
},
{
"OTIO_SCHEMA": "Adapter.1",
"name": "kdenlive",
"execution_scope": "in process",
"filepath": "kdenlive.py",
"suffixes": ["kdenlive"]
}
Expand All @@ -69,7 +60,6 @@
{
"OTIO_SCHEMA" : "SchemaDef.1",
"name" : "xges",
"execution_scope" : "in process",
"filepath" : "xges.py"
}
]
Expand Down
5 changes: 0 additions & 5 deletions docs/tutorials/otio-serialized-schema-only-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ changes. If it needs to be updated and this file regenerated, run:
### Adapter.1

parameters:
- *execution_scope*
- *filepath*
- *name*
- *suffixes*
Expand Down Expand Up @@ -77,7 +76,6 @@ parameters:
### HookScript.1

parameters:
- *execution_scope*
- *filepath*
- *name*

Expand All @@ -86,7 +84,6 @@ parameters:
### MediaLinker.1

parameters:
- *execution_scope*
- *filepath*
- *name*

Expand Down Expand Up @@ -126,7 +123,6 @@ parameters:
### SerializableObject.1

parameters:
- *execution_scope*
- *filepath*
- *name*

Expand Down Expand Up @@ -282,6 +278,5 @@ parameters:
### SchemaDef.1

parameters:
- *execution_scope*
- *filepath*
- *name*
5 changes: 0 additions & 5 deletions docs/tutorials/otio-serialized-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Adapters convert between OTIO and other formats.
```

parameters:
- *execution_scope*: Describes whether this adapter is executed in the current python process or in a subshell. Options are: ['in process', 'out of process'].
- *filepath*: Absolute path or relative path to adapter module from location of json.
- *name*: Adapter name.
- *suffixes*: File suffixes associated with this adapter.
Expand Down Expand Up @@ -155,7 +154,6 @@ None
```

parameters:
- *execution_scope*: Describes whether this adapter is executed in the current python process or in a subshell. Options are: ['in process', 'out of process'].
- *filepath*: Absolute path or relative path to adapter module from location of json.
- *name*: Adapter name.

Expand All @@ -172,7 +170,6 @@ None
```

parameters:
- *execution_scope*: Describes whether this adapter is executed in the current python process or in a subshell. Options are: ['in process', 'out of process'].
- *filepath*: Absolute path or relative path to adapter module from location of json.
- *name*: Adapter name.

Expand Down Expand Up @@ -270,7 +267,6 @@ A class of plugin that is encoded in a python module, exposed via a
```

parameters:
- *execution_scope*: Describes whether this adapter is executed in the current python process or in a subshell. Options are: ['in process', 'out of process'].
- *filepath*: Absolute path or relative path to adapter module from location of json.
- *name*: Adapter name.

Expand Down Expand Up @@ -658,6 +654,5 @@ None
```

parameters:
- *execution_scope*: Describes whether this adapter is executed in the current python process or in a subshell. Options are: ['in process', 'out of process'].
- *filepath*: Absolute path or relative path to adapter module from location of json.
- *name*: Adapter name.
1 change: 0 additions & 1 deletion docs/tutorials/write-a-hookscript.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ To create a new OTIO hook script, you need to create a file myhooks.py. Then add
{
"OTIO_SCHEMA" : "HookScript.1",
"name" : "example hook",
"execution_scope" : "in process",
"filepath" : "myhooks.py"
}
],
Expand Down
14 changes: 11 additions & 3 deletions docs/tutorials/write-a-media-linker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ OpenTimelineIO Media Linkers are plugins that allow OTIO to replace MissingRefer

The current MediaLinker can be specified as an argument to `otio.adapters.read_from_file` or via an environment variable. If one is specified, then it will run after the adapter reads the contents of the file before it is returned back.

```python
#/usr/bin/env python
import opentimelineio as otio
mytimeline = otio.adapters.read_from_file("something.edl", media_linker_name="awesome_studios_media_linker")
```

After the EDL adapter reads something.edl, the media linker "awesome_studios_media_linker" will run and link the media in the file (if it can).

Expand All @@ -16,25 +18,28 @@ After the EDL adapter reads something.edl, the media linker "awesome_studios_med
To create a new OTIO Adapter, you need to create a file mymedialinker.py. Then add a manifest that points at that python file:


```json
{
"OTIO_SCHEMA" : "PluginManifest.1",
"media_linkers" : [
{
"OTIO_SCHEMA" : "MediaLinker.1",
"name" : "awesome_studios_media_linker",
"execution_scope" : "in process",
"filepath" : "mymedialinker.py"
}
],
"adapters" : [
]
}
```
Then you need to add this manifest to your `$OTIO_PLUGIN_MANIFEST_PATH` environment variable (which is separated with `:` for POSIX or `;` for Windows).

Finally, to specify this linker as the default media linker, set `OTIO_DEFAULT_MEDIA_LINKER` to the name of the media linker:

setenv OTIO_DEFAULT_MEDIA_LINKER "awesome_studios_media_linker"
```bash
export OTIO_DEFAULT_MEDIA_LINKER="awesome_studios_media_linker"
```

To package and share your media linker, follow [these instructions](write-an-adapter.md#packaging-and-sharing-custom-adapters).

Expand All @@ -44,17 +49,20 @@ To write a media linker, write a python file with a "link_media_reference" funct

For example:

```python
def link_media_reference(in_clip, media_linker_argument_map):
d.update(media_linker_argument_map)
# you'll probably want to set it to something other than a missing reference
in_clip.media_reference = otio.schema.MissingReference(
name=in_clip.name + "_tweaked",
metadata=d
)
```

## For Testing

The otioconvert.py script has a --media-linker argument you can use to test out your media linker (once its on the path).

```bash
env OTIO_PLUGIN_MANIFEST_PATH=mymanifest.otio.json:$OTIO_PLUGIN_MANIFEST_PATH bin/otioconvert.py -i somefile.edl --media-linker="awesome_studios_media_linker" -o /var/tmp/test.otio

```
1 change: 0 additions & 1 deletion docs/tutorials/write-a-schemadef.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ Then you must add it to a plugin manifest:
{
"OTIO_SCHEMA" : "SchemaDef.1",
"name" : "mything",
"execution_scope" : "in process",
"filepath" : "mything.py"
}
]
Expand Down
6 changes: 0 additions & 6 deletions docs/tutorials/write-an-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ And a `plugin_manifest.json` like:
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "adapter_x",
"execution_scope" : "in process",
"filepath" : "adapters/my_adapter_x.py",
"suffixes" : ["xxx"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "adapter_y",
"execution_scope" : "in process",
"filepath" : "adapters/my_adapter_y.py",
"suffixes" : ["yyy", "why"]
}
Expand All @@ -89,7 +87,6 @@ And a `plugin_manifest.json` like:
{
"OTIO_SCHEMA" : "MediaLinker.1",
"name" : "my_studios_media_linker",
"execution_scope" : "in process",
"filepath" : "operations/my_linker.py"
}
]
Expand All @@ -105,14 +102,11 @@ For example, to register `myadapter.py` that supports files with a `.myext` file
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "myadapter",
"execution_scope" : "in process",
"filepath" : "myadapter.py",
"suffixes" : ["myext"]
}
```

Currently (as of OTIO Beta 14) only execution_scope "in process" is supported.

## Required Functions

Each adapter must implement at least one of these functions:
Expand Down
2 changes: 0 additions & 2 deletions examples/sample_plugin/otio_counter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
{
"OTIO_SCHEMA": "Adapter.1",
"name": "track_counter",
"execution_scope": "in process",
"filepath": "adapter.py",
"suffixes": ["count"]
}
Expand All @@ -43,7 +42,6 @@
{
"OTIO_SCHEMA" : "MediaLinker.1",
"name" : "linker_example",
"execution_scope" : "in process",
"filepath" : "linker.py"
}
Expand Down
1 change: 0 additions & 1 deletion examples/sample_plugin/otio_counter/plugin_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{
"OTIO_SCHEMA": "Adapter.1",
"name": "track_counter",
"execution_scope": "in process",
"filepath": "adapter.py",
"suffixes": ["count"]
}
Expand Down
6 changes: 0 additions & 6 deletions src/py-opentimelineio/opentimelineio/adapters/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ class Adapter(plugins.PythonPlugin):
def __init__(
self,
name=None,
execution_scope=None,
filepath=None,
suffixes=None
):
plugins.PythonPlugin.__init__(
self,
name,
execution_scope,
filepath
)

Expand Down Expand Up @@ -284,11 +282,9 @@ def __str__(self):
"Adapter("
"{}, "
"{}, "
"{}, "
"{}"
")".format(
repr(self.name),
repr(self.execution_scope),
repr(self.filepath),
repr(self.suffixes),
)
Expand All @@ -298,12 +294,10 @@ def __repr__(self):
return (
"otio.adapter.Adapter("
"name={}, "
"execution_scope={}, "
"filepath={}, "
"suffixes={}"
")".format(
repr(self.name),
repr(self.execution_scope),
repr(self.filepath),
repr(self.suffixes),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,36 @@
{
"OTIO_SCHEMA": "Adapter.1",
"name": "fcp_xml",
"execution_scope": "in process",
"filepath": "fcp_xml.py",
"suffixes": ["xml"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "otio_json",
"execution_scope" : "in process",
"filepath" : "otio_json.py",
"suffixes" : ["otio"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "otioz",
"execution_scope" : "in process",
"filepath" : "otioz.py",
"suffixes" : ["otioz"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "otiod",
"execution_scope" : "in process",
"filepath" : "otiod.py",
"suffixes" : ["otiod"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "cmx_3600",
"execution_scope" : "in process",
"filepath" : "cmx_3600.py",
"suffixes" : ["edl"]
},
{
"OTIO_SCHEMA" : "Adapter.1",
"name" : "svg",
"execution_scope" : "in process",
"filepath" : "svg.py",
"suffixes" : ["svg"]
}
Expand Down
Loading

0 comments on commit 531edf5

Please sign in to comment.