This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
[draft] convert premiere to pype2 #92
Closed
jakubjezek001
wants to merge
31
commits into
develop
from
feature/PYPE-624-convert-premiere-to-pype2
Closed
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
0c4e560
Merge branch 'develop' into feature/PYPE-624-convert-premiere-to-pype2
3a3bb0a
feat(premiere): conversion to pype2 - wip
0ce4a3d
feat(premiere): adding pysync.py to vendors
3facd29
feat(premiere): updating pysync in vendors
70ef1d8
feat(premiere): extension package.json for node_modules
124e61a
feat(premiere): wip wrapper
a0ab0fe
feat(premiere): update static page
082fbb3
allow multiple statics server and fixed few smaller bugs
iLLiCiTiT 64bdfe9
put process route back
iLLiCiTiT e34d21c
basic implementation of premiere communicator
iLLiCiTiT 352ec7d
feat(ppro): prelaunch finalized wrapping
d4c773d
feat(ppro): changing url for restapi
fd08af2
feat(ppro): lib pep8 fixes
ef307e9
feat(ppro): moving static gui pages to ppro
a88b808
feat(service): adding adobe restapi service
0c6a078
feat(service): missing init added
21197ec
feat(ppre): updating extension and its dependencies
9de1d2c
feat(premiere): wip extension to pype2
16840a9
feat(ppro): reworking `api` to `pras` > pype rest api server
5436a39
feat(): pype.jsx, pype.js fix syntax
f2c5beb
feat(): improving batchRenamer loading
6ffacaa
gitignore debug log
977879c
feat(): wip aport to restapi
e1395fb
Merge branch 'develop' into feature/PYPE-624-convert-premiere-to-pype2
405eaeb
feat(ppro): wip on refactory to pype2
12ceadf
feat(ppro): wip on refactoring
ba9524d
feat(ppro): wip on extension
a22ae98
feat(ppro): wip publishing from premiere
8a484e8
feat(ppro): unnecessary imports
b04805a
feat(ppro): wip publishing clips
3070e17
fix(adobe, ppro): clearing code
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ coverage.xml | |
################## | ||
node_modules/ | ||
package-lock.json | ||
|
||
pype/premiere/ppro/js/debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
import traceback | ||
from pype.lib import PypeHook | ||
from pypeapp import Logger | ||
import importlib | ||
import avalon.api | ||
import pype.premiere | ||
from pype.premiere import lib as prlib | ||
|
||
|
||
class PremierePrelaunch(PypeHook): | ||
""" | ||
This hook will check if current workfile path has Adobe Premiere | ||
project inside. IF not, it initialize it and finally it pass | ||
path to the project by environment variable to Premiere launcher | ||
shell script. | ||
""" | ||
|
||
def __init__(self, logger=None): | ||
if not logger: | ||
self.log = Logger().get_logger(self.__class__.__name__) | ||
else: | ||
self.log = logger | ||
|
||
self.signature = "( {} )".format(self.__class__.__name__) | ||
|
||
def execute(self, *args, env: dict = None) -> bool: | ||
|
||
if not env: | ||
env = os.environ | ||
|
||
try: | ||
__import__("pype.premiere") | ||
__import__("pyblish") | ||
|
||
except ImportError as e: | ||
print(traceback.format_exc()) | ||
print("pyblish: Could not load integration: %s " % e) | ||
|
||
else: | ||
# Premiere Setup integration | ||
importlib.reload(prlib) | ||
prlib.setup(env) | ||
|
||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import os | ||
import pyblish.api | ||
from avalon import ( | ||
io, | ||
api as avalon | ||
) | ||
import json | ||
from pathlib import Path | ||
|
||
|
||
class CollectContextDataFromAport(pyblish.api.ContextPlugin): | ||
""" | ||
Collecting temp json data sent from a host context | ||
and path for returning json data back to hostself. | ||
|
||
Setting avalon session into correct context | ||
|
||
Args: | ||
context (obj): pyblish context session | ||
|
||
""" | ||
|
||
label = "AdobeCommunicator Collect Context" | ||
order = pyblish.api.CollectorOrder - 0.49 | ||
|
||
def process(self, context): | ||
self.log.info("registred_hosts: `{}`".format(pyblish.api.registered_hosts())) | ||
io.install() | ||
# get json paths from data | ||
input_json_path = os.environ.get("AC_PUBLISH_INPATH") | ||
output_json_path = os.environ.get("AC_PUBLISH_OUTPATH") | ||
|
||
rqst_json_data_path = Path(input_json_path) | ||
post_json_data_path = Path(output_json_path) | ||
|
||
context.data['post_json_data_path'] = str(post_json_data_path) | ||
|
||
# get avalon session data and convert \ to / | ||
_S = avalon.session | ||
|
||
projects = Path(_S["AVALON_PROJECTS"]).resolve() | ||
asset = _S["AVALON_ASSET"] | ||
workdir = Path(_S["AVALON_WORKDIR"]).resolve() | ||
_S["AVALON_PROJECTS"] = str(projects) | ||
_S["AVALON_WORKDIR"] = str(workdir) | ||
|
||
context.data["avalonSession"] = _S | ||
self.log.info(f"__ avalonSession: `{_S}`") | ||
|
||
# get stagin directory from recieved path to json | ||
context.data["stagingDir"] = post_json_data_path.parent | ||
|
||
# get data from json file recieved | ||
with rqst_json_data_path.open(mode='r') as f: | ||
context.data["jsonData"] = json_data = json.load(f) | ||
assert json_data, "No `data` in json file" | ||
|
||
# get and check host type | ||
host = json_data.get("host", None) | ||
host_version = json_data.get("hostVersion", None) | ||
assert host, "No `host` data in json file" | ||
assert host_version, "No `hostVersion` data in json file" | ||
context.data["host"] = _S["AVALON_APP"] = host | ||
context.data["hostVersion"] = \ | ||
_S["AVALON_APP_VERSION"] = host_version | ||
|
||
# get current file | ||
current_file = json_data.get("currentFile", None) | ||
assert current_file, "No `currentFile` data in json file" | ||
context.data["currentFile"] = Path(current_file).resolve() | ||
|
||
# get project data from avalon | ||
project_data = io.find_one({'type': 'project'}) | ||
assert project_data, "No `project_data` data in avalon db" | ||
context.data["projectData"] = project_data | ||
self.log.debug("project_data: {}".format(project_data)) | ||
|
||
# get asset data from avalon and fix all paths | ||
asset_data = io.find_one({ | ||
"type": 'asset', | ||
"name": asset | ||
})["data"] | ||
assert asset_data, "No `asset_data` data in avalon db" | ||
|
||
context.data["assetData"] = asset_data | ||
|
||
self.log.debug("asset_data: {}".format(asset_data)) | ||
self.log.info("rqst_json_data_path is: {}".format(rqst_json_data_path)) | ||
self.log.info("post_json_data_path is: {}".format(post_json_data_path)) | ||
|
||
# self.log.info("avalon.session is: {}".format(avalon.session)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__import__()
can return in some casesValueError
on python < 3.9. See (https://bugs.python.org/issue37444)