AcademySoftwareFoundation / OpenTimelineIO

Open Source API and interchange format for editorial timeline information.
http://opentimeline.io
Apache License 2.0
1.45k stars 287 forks source link

Added support for custom adapter hooks #1711

Closed timlehr closed 3 months ago

timlehr commented 6 months ago

Summarize your change.

This adds support for attributing custom hooks to adapters and executing them with hook_function_argument_map being passed along through the adapter IO functions.

Describe the reason for the change.

I added two custom hooks to the OTIO AAF adapter (https://github.com/OpenTimelineIO/otio-aaf-adapter/pull/43), allowing for embedding of media essence into the resulting AAF. This was needed to facilitate just-in-time DNXHR transcoding of the media for the AAF creation and adding a certain level of control and flexibility to the feature.

These features to the core are required in order to properly pass the hook argument map along to potential custom hooks run by the adapter. I tried to work with _FEATURE_MAP instead of creating a new version of the Adapter schema in order to minimize the impact of this change, while adding the necessary changes to facilitate custom hooks for adapters.

Reference associated tests.

tests/test_adapter_plugin.py
tests/test_hooks_plugins.py
codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 74.20%. Comparing base (134b9b2) to head (f6b309e).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711/graphs/tree.svg?width=650&height=150&src=pr&token=mfnfUB4h7u&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation)](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) ```diff @@ Coverage Diff @@ ## extract_adapters #1711 +/- ## ==================================================== + Coverage 74.16% 74.20% +0.04% ==================================================== Files 175 176 +1 Lines 12056 12091 +35 Branches 2789 2794 +5 ==================================================== + Hits 8941 8972 +31 - Misses 1356 1358 +2 - Partials 1759 1761 +2 ``` | [Flag](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | Coverage Δ | | |---|---|---| | [py-unittests](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | `74.20% <90.90%> (+0.04%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | Coverage Δ | | |---|---|---| | [...sts/baselines/custom\_adapter\_hookscript\_example.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvYmFzZWxpbmVzL2N1c3RvbV9hZGFwdGVyX2hvb2tzY3JpcHRfZXhhbXBsZS5weQ==) | `100.00% <100.00%> (ø)` | | | [tests/baselines/example.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvYmFzZWxpbmVzL2V4YW1wbGUucHk=) | `100.00% <100.00%> (ø)` | | | [tests/test\_adapter\_plugin.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvdGVzdF9hZGFwdGVyX3BsdWdpbi5weQ==) | `87.83% <100.00%> (+0.08%)` | :arrow_up: | | [tests/test\_hooks\_plugins.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-dGVzdHMvdGVzdF9ob29rc19wbHVnaW5zLnB5) | `98.01% <100.00%> (+0.29%)` | :arrow_up: | | [...-opentimelineio/opentimelineio/adapters/adapter.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lbGluZWlvL2FkYXB0ZXJzL2FkYXB0ZXIucHk=) | `78.37% <73.33%> (-1.63%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). Last update [134b9b2...f6b309e](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1711?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation).
timlehr commented 6 months ago

@ssteinbach If you could have a look at this sometime, that'd be wonderful. See https://github.com/OpenTimelineIO/otio-aaf-adapter/pull/43 for why this is needed.

reinecke commented 6 months ago

@timlehr Can you switch the base branch in this PR to the new extract_adapters_post_beta_16 branch - that one was rebased on the main branch after the beta 16 release.

timlehr commented 6 months ago

@reinecke Just rebased the code!

ssteinbach commented 5 months ago

@reinecke @timlehr did the rebase capture too much stuff? It seems like there is a lot in here -- or did the base change w/o/ rebasing?

(sorry, accidentally closed/reopened the PR)

timlehr commented 5 months ago

@ssteinbach Seems like there were force-pushes to the extract_adapters_post_beta_16 branch after I rebased, so I will have to do that again.