Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/579-Publish_EDL'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolar committed Oct 1, 2020
2 parents 1bd660f + 4b754ee commit 9cd15b9
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 44 deletions.
51 changes: 16 additions & 35 deletions pype/plugins/global/publish/extract_hierarchy_avalon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pyblish.api
from avalon import io

from copy import deepcopy

class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
"""Create entities in Avalon based on collected data."""
Expand All @@ -14,14 +14,12 @@ def process(self, context):
if "hierarchyContext" not in context.data:
self.log.info("skipping IntegrateHierarchyToAvalon")
return
hierarchy_context = deepcopy(context.data["hierarchyContext"])

if not io.Session:
io.install()

active_assets = []
hierarchy_context = context.data["hierarchyContext"]
hierarchy_assets = self._get_assets(hierarchy_context)

# filter only the active publishing insatnces
for instance in context:
if instance.data.get("publish") is False:
Expand All @@ -32,13 +30,13 @@ def process(self, context):

active_assets.append(instance.data["asset"])

# filter out only assets which are activated as isntances
new_hierarchy_assets = {k: v for k, v in hierarchy_assets.items()
if k in active_assets}
# remove duplicity in list
self.active_assets = list(set(active_assets))
self.log.debug("__ self.active_assets: {}".format(self.active_assets))

# modify the hierarchy context so there are only fitred assets
self._set_assets(hierarchy_context, new_hierarchy_assets)
hierarchy_context = self._get_assets(hierarchy_context)

self.log.debug("__ hierarchy_context: {}".format(hierarchy_context))
input_data = context.data["hierarchyContext"] = hierarchy_context

self.project = None
Expand Down Expand Up @@ -178,35 +176,18 @@ def _get_assets(self, input_dict):
Usually the last part of deep dictionary which
is not having any children
"""
input_dict_copy = deepcopy(input_dict)

for key in input_dict.keys():
self.log.debug("__ key: {}".format(key))
# check if child key is available
if input_dict[key].get("childs"):
# loop deeper
return self._get_assets(input_dict[key]["childs"])
input_dict_copy[key]["childs"] = self._get_assets(
input_dict[key]["childs"])
else:
# give the dictionary with assets
return input_dict
# filter out unwanted assets
if key not in self.active_assets:
input_dict_copy.pop(key, None)

def _set_assets(self, input_dict, new_assets=None):
""" Modify the hierarchy context dictionary.
It will replace the asset dictionary with only the filtred one.
"""
for key in input_dict.keys():
# check if child key is available
if input_dict[key].get("childs"):
# return if this is just for testing purpose and no
# new_assets property is avalable
if not new_assets:
return True

# test for deeper inner children availabelity
if self._set_assets(input_dict[key]["childs"]):
# if one level deeper is still children available
# then process farther
self._set_assets(input_dict[key]["childs"], new_assets)
else:
# or just assign the filtred asset ditionary
input_dict[key]["childs"] = new_assets
else:
# test didnt find more childs in input dictionary
return None
return input_dict_copy
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class CollectClipInstances(pyblish.api.InstancePlugin):
subsets = {
"referenceMain": {
"family": "review",
"families": ["review", "ftrack"],
"families": ["clip", "ftrack"],
# "ftrackFamily": "review",
"extension": ".mp4"
},
"audioMain": {
"family": "audio",
"families": ["ftrack"],
"families": ["clip", "ftrack"],
# "ftrackFamily": "audio",
"extension": ".wav",
# "version": 1
Expand Down
29 changes: 29 additions & 0 deletions pype/plugins/standalonepublisher/publish/collect_instance_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Requires:
Nothing
Provides:
Instance
"""

import pyblish.api
from pprint import pformat


class CollectInstanceData(pyblish.api.InstancePlugin):
"""
Collector with only one reason for its existence - remove 'ftrack'
family implicitly added by Standalone Publisher
"""

label = "Collect instance data"
order = pyblish.api.CollectorOrder + 0.49
families = ["render", "plate"]
hosts = ["standalonepublisher"]

def process(self, instance):
fps = instance.data["assetEntity"]["data"]["fps"]
instance.data.update({
"fps": fps
})
self.log.debug(f"instance.data: {pformat(instance.data)}")
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ExtractShotData(pype.api.Extractor):

label = "Extract Shot Data"
hosts = ["standalonepublisher"]
families = ["review", "audio"]
families = ["clip"]

# presets

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def process(self, instance):
else:
# Convert to jpeg if not yet
full_input_path = os.path.join(thumbnail_repre["stagingDir"], file)
full_input_path = '"{}"'.format(full_input_path)
self.log.info("input {}".format(full_input_path))

full_thumbnail_path = tempfile.mkstemp(suffix=".jpg")[1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import pyblish.api
import pype.api

Expand All @@ -9,10 +7,14 @@ class ValidateEditorialResources(pyblish.api.InstancePlugin):

label = "Validate Editorial Resources"
hosts = ["standalonepublisher"]
families = ["audio", "review"]
families = ["clip"]

order = pype.api.ValidateContentsOrder

def process(self, instance):
self.log.debug(
f"Instance: {instance}, Families: "
f"{[instance.data['family']] + instance.data['families']}")
check_file = instance.data["editorialVideoPath"]
msg = f"Missing \"{check_file}\"."
assert check_file, msg
2 changes: 1 addition & 1 deletion pype/scripts/otio_burnin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


FFMPEG = (
'{} -loglevel panic -i %(input)s %(filters)s %(args)s%(output)s'
'{} -loglevel panic -i "%(input)s" %(filters)s %(args)s%(output)s'
).format(ffmpeg_path)

FFPROBE = (
Expand Down
5 changes: 3 additions & 2 deletions pype/tools/standalonepublish/widgets/widget_drop_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ def load_data_with_probe(self, filepath):
args = [
ffprobe_path,
'-v', 'quiet',
'-print_format', 'json',
'-print_format json',
'-show_format',
'-show_streams', filepath
'-show_streams',
'"{}"'.format(filepath)
]
ffprobe_p = subprocess.Popen(
' '.join(args),
Expand Down

0 comments on commit 9cd15b9

Please sign in to comment.