mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
OP-1950 - added endpoint for configured extensions
This commit is contained in:
parent
d7801793a0
commit
f24b912e8a
2 changed files with 29 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ from avalon.api import AvalonMongoDB
|
|||
from openpype.lib import OpenPypeMongoConnection
|
||||
from openpype_modules.avalon_apps.rest_api import _RestApiEndpoint
|
||||
from openpype.lib.plugin_tools import parse_json
|
||||
from openpype.settings import get_project_settings
|
||||
|
||||
from openpype.lib import PypeLogger
|
||||
|
||||
|
|
@ -277,3 +278,22 @@ class PublishesStatusEndpoint(_RestApiEndpoint):
|
|||
body=self.resource.encode(output),
|
||||
content_type="application/json"
|
||||
)
|
||||
|
||||
|
||||
class ConfiguredExtensionsEndpoint(_RestApiEndpoint):
|
||||
"""Returns list of extensions which have mapping to family."""
|
||||
async def get(self, project_name=None) -> Response:
|
||||
sett = get_project_settings(project_name)
|
||||
|
||||
configured = []
|
||||
collect_conf = sett["webpublisher"]["publish"]["CollectPublishedFiles"]
|
||||
for _, mapping in collect_conf.get("task_type_to_family", {}).items():
|
||||
for _family, config in mapping.items():
|
||||
configured.extend(config["extensions"])
|
||||
configured = set(configured)
|
||||
|
||||
return Response(
|
||||
status=200,
|
||||
body=self.resource.encode(sorted(list(configured))),
|
||||
content_type="application/json"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ from .webpublish_routes import (
|
|||
WebpublisherHiearchyEndpoint,
|
||||
WebpublisherProjectsEndpoint,
|
||||
BatchStatusEndpoint,
|
||||
PublishesStatusEndpoint
|
||||
PublishesStatusEndpoint,
|
||||
ConfiguredExtensionsEndpoint
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -49,6 +50,13 @@ def run_webserver(*args, **kwargs):
|
|||
hiearchy_endpoint.dispatch
|
||||
)
|
||||
|
||||
configured_ext_endpoint = ConfiguredExtensionsEndpoint(resource)
|
||||
server_manager.add_route(
|
||||
"GET",
|
||||
"/api/webpublish/configured_ext/{project_name}",
|
||||
configured_ext_endpoint.dispatch
|
||||
)
|
||||
|
||||
# triggers publish
|
||||
webpublisher_task_publish_endpoint = \
|
||||
WebpublisherBatchPublishEndpoint(resource)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue