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

Commit

Permalink
Merge pull request #1876 from pypeclub/feature/webpublisher_backend
Browse files Browse the repository at this point in the history
Feature/webpublisher backend
  • Loading branch information
kalisp authored Aug 27, 2021
2 parents 3b25d2a + cb229e9 commit bf1dad4
Show file tree
Hide file tree
Showing 21 changed files with 1,305 additions and 14 deletions.
44 changes: 44 additions & 0 deletions openpype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,31 @@ def eventserver(debug,
)


@main.command()
@click.option("-d", "--debug", is_flag=True, help="Print debug messages")
@click.option("-h", "--host", help="Host", default=None)
@click.option("-p", "--port", help="Port", default=None)
@click.option("-e", "--executable", help="Executable")
@click.option("-u", "--upload_dir", help="Upload dir")
def webpublisherwebserver(debug, executable, upload_dir, host=None, port=None):
"""Starts webserver for communication with Webpublish FR via command line
OP must be congigured on a machine, eg. OPENPYPE_MONGO filled AND
FTRACK_BOT_API_KEY provided with api key from Ftrack.
Expect "pype.club" user created on Ftrack.
"""
if debug:
os.environ['OPENPYPE_DEBUG'] = "3"

PypeCommands().launch_webpublisher_webservercli(
upload_dir=upload_dir,
executable=executable,
host=host,
port=port
)


@main.command()
@click.argument("output_json_path")
@click.option("--project", help="Project name", default=None)
Expand Down Expand Up @@ -131,6 +156,25 @@ def publish(debug, paths, targets):
PypeCommands.publish(list(paths), targets)


@main.command()
@click.argument("path")
@click.option("-d", "--debug", is_flag=True, help="Print debug messages")
@click.option("-h", "--host", help="Host")
@click.option("-u", "--user", help="User email address")
@click.option("-p", "--project", help="Project")
@click.option("-t", "--targets", help="Targets", default=None,
multiple=True)
def remotepublish(debug, project, path, host, targets=None, user=None):
"""Start CLI publishing.
Publish collects json from paths provided as an argument.
More than one path is allowed.
"""
if debug:
os.environ['OPENPYPE_DEBUG'] = '3'
PypeCommands.remotepublish(project, path, host, user, targets=targets)


@main.command()
@click.option("-d", "--debug", is_flag=True, help="Print debug messages")
@click.option("-p", "--project", required=True,
Expand Down
6 changes: 6 additions & 0 deletions openpype/hosts/webpublisher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Webpublisher
-------------

Plugins meant for processing of Webpublisher.

Gets triggered by calling openpype.cli.remotepublish with appropriate arguments.
Empty file.
43 changes: 43 additions & 0 deletions openpype/hosts/webpublisher/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import logging

from avalon import api as avalon
from avalon import io
from pyblish import api as pyblish
import openpype.hosts.webpublisher

log = logging.getLogger("openpype.hosts.webpublisher")

HOST_DIR = os.path.dirname(os.path.abspath(
openpype.hosts.webpublisher.__file__))
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")


def application_launch():
pass


def install():
print("Installing Pype config...")

pyblish.register_plugin_path(PUBLISH_PATH)
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
avalon.register_plugin_path(avalon.Creator, CREATE_PATH)
log.info(PUBLISH_PATH)

io.install()
avalon.on("application.launched", application_launch)


def uninstall():
pyblish.deregister_plugin_path(PUBLISH_PATH)
avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH)
avalon.deregister_plugin_path(avalon.Creator, CREATE_PATH)


# to have required methods for interface
def ls():
pass
28 changes: 28 additions & 0 deletions openpype/hosts/webpublisher/plugins/publish/collect_fps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Requires:
Nothing
Provides:
Instance
"""

import pyblish.api
from pprint import pformat


class CollectFPS(pyblish.api.InstancePlugin):
"""
Adds fps from context to instance because of ExtractReview
"""

label = "Collect fps"
order = pyblish.api.CollectorOrder + 0.49
hosts = ["webpublisher"]

def process(self, instance):
fps = instance.context.data["fps"]

instance.data.update({
"fps": fps
})
self.log.debug(f"instance.data: {pformat(instance.data)}")
Loading

0 comments on commit bf1dad4

Please sign in to comment.