Harmon to Deadline - added audio file collect

This commit is contained in:
Petr Kalis 2021-01-20 18:26:52 +01:00
parent 24d84b46e0
commit 55d447f1d6
2 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,36 @@
import os
import pyblish.api
import pyblish.api
from avalon import harmony
class CollectAudio(pyblish.api.InstancePlugin):
"""
Collect relative path for audio file to instance.
Harmony api `getSoundtrackAll` returns useless path to temp folder,
for render on farm we look into 'audio' folder and select first file.
Correct path needs to be calculated in `submit_harmony_deadline.py`
"""
order = pyblish.api.CollectorOrder + 0.499
label = "Collect Audio"
hosts = ["harmony"]
families = ["renderlayer"]
def process(self, instance):
audio_dir = os.path.join(
os.path.dirname(instance.context.data.get("currentFile")), 'audio')
if os.path.isdir(audio_dir):
for full_file_name in os.listdir(audio_dir):
file_name, file_ext = os.path.splitext(full_file_name)
if file_ext not in ['.wav', '.mp3', '.aiff']:
self.log.error("Unsupported file {}.{}".format(file_name,
file_ext))
audio_file_path = os.path.join('audio', full_file_name)
self.log.error("audio_file_path {}".format(audio_file_path))
instance.data["audioFile"] = audio_file_path

View file

@ -370,6 +370,11 @@ class HarmonySubmitDeadline(
_file.replace(work_path_str, render_path_str)
)
audio_file = self._instance.data.get("audioFile")
if audio_file:
abs_path = xstage_path.parent / audio_file
self._instance.context.data["audioFile"] = str(abs_path)
self._instance.data["source"] = str(published_scene.as_posix())
self._instance.data["expectedFiles"] = new_expected_files
harmony_plugin_info = PluginInfo(