mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
Merge pull request #2221 from pypeclub/feature/OP-1950_Add-endpoint-about-configured-extensions-for-webpublisher
Added endpoint for configured extensions
This commit is contained in:
commit
5d5aaeb7d3
2 changed files with 45 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
|
||||
|
||||
|
|
@ -39,6 +40,8 @@ class RestApiResource:
|
|||
return value.isoformat()
|
||||
if isinstance(value, ObjectId):
|
||||
return str(value)
|
||||
if isinstance(value, set):
|
||||
return list(value)
|
||||
raise TypeError(value)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -315,3 +318,36 @@ class PublishesStatusEndpoint(_RestApiEndpoint):
|
|||
body=self.resource.encode(output),
|
||||
content_type="application/json"
|
||||
)
|
||||
|
||||
|
||||
class ConfiguredExtensionsEndpoint(_RestApiEndpoint):
|
||||
"""Returns dict of extensions which have mapping to family.
|
||||
|
||||
Returns:
|
||||
{
|
||||
"file_exts": [],
|
||||
"sequence_exts": []
|
||||
}
|
||||
"""
|
||||
async def get(self, project_name=None) -> Response:
|
||||
sett = get_project_settings(project_name)
|
||||
|
||||
configured = {
|
||||
"file_exts": set(),
|
||||
"sequence_exts": set(),
|
||||
# workfiles that could have "Studio Procesing" hardcoded for now
|
||||
"studio_exts": set(["psd", "psb", "tvpp", "tvp"])
|
||||
}
|
||||
collect_conf = sett["webpublisher"]["publish"]["CollectPublishedFiles"]
|
||||
for _, mapping in collect_conf.get("task_type_to_family", {}).items():
|
||||
for _family, config in mapping.items():
|
||||
if config["is_sequence"]:
|
||||
configured["sequence_exts"].update(config["extensions"])
|
||||
else:
|
||||
configured["file_exts"].update(config["extensions"])
|
||||
|
||||
return Response(
|
||||
status=200,
|
||||
body=self.resource.encode(dict(configured)),
|
||||
content_type="application/json"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ from .webpublish_routes import (
|
|||
WebpublisherHiearchyEndpoint,
|
||||
WebpublisherProjectsEndpoint,
|
||||
BatchStatusEndpoint,
|
||||
PublishesStatusEndpoint
|
||||
PublishesStatusEndpoint,
|
||||
ConfiguredExtensionsEndpoint
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -54,6 +55,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