Skip to content

integrate_site_sync

Adds state of published representations for syncing.

Each published representation might be marked to be synced to multiple sites. On some might be present (by default 'studio'), on some needs to be synchronized.

IntegrateSiteSync

Bases: InstancePlugin

Adds state of published representations for syncing.

Source code in client/ayon_sitesync/plugins/publish/integrate_site_sync.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class IntegrateSiteSync(pyblish.api.InstancePlugin):
    """Adds state of published representations for syncing."""

    order = pyblish.api.IntegratorOrder + 0.2
    label = "Integrate Site Sync state"

    def process(self, instance):
        published_representations = instance.data.get(
            "published_representations")
        if not published_representations:
            self.log.debug("Instance does not have published representations")
            return

        context = instance.context
        project_name = context.data["projectEntity"]["name"]
        addons_manager = context.data["ayonAddonsManager"]
        sitesync_addon = addons_manager.get_enabled_addon("sitesync")
        if sitesync_addon is None:
            return

        sites = sitesync_addon.compute_resource_sync_sites(
            project_name=project_name
        )
        for repre_id, inst in published_representations.items():
            for site_info in sites:
                sitesync_addon.add_site(
                    project_name,
                    repre_id,
                    site_info["name"],
                    status=site_info["status"]
                )