Hello again.
Fabià, I couldn’t agree more with you. Headless publishing should be a lot more straight-forward and abstract.
Digging around on this topic, I found #felixdavriv’s take here:
Which I’ve spliced into an addon (using example_addon as template) so I can run it as a module:
poetry run python start.py module batch_publish_addon process-directory
And it does publish to OP, though not to Kitsu, not sure why (Tray publisher does work as expected for single items and it does push to Kitsu)
The business bit comes from Felix pretty much untouched:
# Build required pyblish data
os.environ["AVALON_ASSET"] = asset['name']
context = pyblish.api.Context()
instance = context.create_instance(name=asset['name'])
instance.data.update(
{
"family": "review",
"asset": asset['name'],
"task": "Concept",
"subset": "background",
"publish": True,
"active": True,
"source": filepath.as_posix(),
}
)
# Add representation
ext = filepath.suffix.strip(".")
representation = {
"name": ext,
"ext": ext,
"preview": True,
"tags": ["review"],
"files": filepath.name,
"stagingDir": filepath.parent,
}
instance.data.setdefault("representations", [])
instance.data["representations"].append(representation)
# Publish to OP
context = pyblish.util.publish(context)
The only thing suspicious I see in the output is:
DEBUG:pyblish.ValidateIntent:Profile selected: {'hosts': [], 'task_types': [], 'tasks': [], 'validate': False}
DEBUG:pyblish.ValidateIntent:Validation of intent was skipped. Matching profile for current context disabled validation.
DEBUG:pyblish.ValidatePublishDir:Looking for matching profile for: hosts: "None" | families: "review" | task_names: "Concept" | task_types: "Concept"
DEBUG:pyblish.ValidatePublishDir:"None" not found in "hosts": ['standalonepublisher']
DEBUG:pyblish.ValidatePublishDir:"None" not found in "hosts": ['maya']
DEBUG:pyblish.ValidatePublishDir:"None" not found in "hosts": ['traypublisher']
DEBUG:pyblish.ValidatePublishDir:Profile selected: {'families': ['review', 'render', 'prerender'], 'hosts': [], 'task_types': [], 'task_names': [], 'template_name': 'render'}
DEBUG:pyblish.CollectComment:Instance BG_INT_Frances_ApartmentWindow does not have set comment
Again pointing to the expectation of running from a ‘host’? #bigroy
Felix’s script was manually uploading to kitsu using gazu api, but it seems like this shouldn’t be necessary?
Again, thanks for all the help!
S