Skip to content

extract_review_source

Export content of Display node as .mov.

ExtractSourceForReview

Bases: Extractor

Use exporter to save .mov from Display node.

review product should be created automatically by CreateReview if enabled.

This currently triggers only locally, not on farm.

Source code in client/ayon_harmony/plugins/publish/extract_review_source.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class ExtractSourceForReview(publish.Extractor):
    """Use exporter to save .mov from Display node.

    `review` product should be created automatically by `CreateReview` if
    enabled.

    This currently triggers only locally, not on farm.
    """

    label = "Extract sources for Review"
    # TODO remove decrement after ayon-core ExtractThumbnailFromSource
    #   is set later
    order = pyblish.api.ExtractorOrder - 0.45
    hosts = ["harmony"]
    families = ["review"]

    def process(self, instance):
        """Plugin entry point."""
        if instance.data["productType"] != "review":
            self.log.info("Not primary `review` product type, skipping.")
            return

        staging_dir = self.staging_dir(instance)
        file_name = f"{instance.name}.mov"
        filepath = os.path.join(staging_dir, file_name)
        self.log.info(f"Exporting to {filepath}")

        sig = harmony.signature()

        display_node_name = instance.data["display_node_name"]

        func = """function %s(args)
        {
            var codec = "openH264";
            var startFrame = -1; // take from timeline
            var endFrame = -1; // take from timeline
            var withSound = true;
            var resX = -1; //take from scene
            var resY = -1;
            var saveTo = args[0];
            var displayToRender = args[1];
            var generateThumbnail = false;
            var thumbnailFrame = 0;
            exporter.exportToQuicktime(
                codec,
                startFrame,
                endFrame,
                withSound,
                resX,
                resY,
                saveTo,
                displayToRender,
                generateThumbnail,
                thumbnailFrame
            )
        }
        %s
        """ % (sig, sig)
        harmony.send(
            {
                "function": func,
                "args": [filepath, display_node_name]
            }
        )

        # for global ExtractReview
        context = instance.context
        instance.data["frameStart"] = context.data["frameStart"]
        instance.data["frameEnd"] = context.data["frameEnd"]
        instance.data["fps"] = context.data["fps"]

        representation = {
            "name": "mov",
            "ext": "mov",
            "files": file_name,
            "stagingDir": staging_dir,
            "tags": ["review", "delete"]
        }

        instance.data["representations"] = [representation]
        instance.data["thumbnailSource"] = filepath

process(instance)

Plugin entry point.

Source code in client/ayon_harmony/plugins/publish/extract_review_source.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def process(self, instance):
    """Plugin entry point."""
    if instance.data["productType"] != "review":
        self.log.info("Not primary `review` product type, skipping.")
        return

    staging_dir = self.staging_dir(instance)
    file_name = f"{instance.name}.mov"
    filepath = os.path.join(staging_dir, file_name)
    self.log.info(f"Exporting to {filepath}")

    sig = harmony.signature()

    display_node_name = instance.data["display_node_name"]

    func = """function %s(args)
    {
        var codec = "openH264";
        var startFrame = -1; // take from timeline
        var endFrame = -1; // take from timeline
        var withSound = true;
        var resX = -1; //take from scene
        var resY = -1;
        var saveTo = args[0];
        var displayToRender = args[1];
        var generateThumbnail = false;
        var thumbnailFrame = 0;
        exporter.exportToQuicktime(
            codec,
            startFrame,
            endFrame,
            withSound,
            resX,
            resY,
            saveTo,
            displayToRender,
            generateThumbnail,
            thumbnailFrame
        )
    }
    %s
    """ % (sig, sig)
    harmony.send(
        {
            "function": func,
            "args": [filepath, display_node_name]
        }
    )

    # for global ExtractReview
    context = instance.context
    instance.data["frameStart"] = context.data["frameStart"]
    instance.data["frameEnd"] = context.data["frameEnd"]
    instance.data["fps"] = context.data["fps"]

    representation = {
        "name": "mov",
        "ext": "mov",
        "files": file_name,
        "stagingDir": staging_dir,
        "tags": ["review", "delete"]
    }

    instance.data["representations"] = [representation]
    instance.data["thumbnailSource"] = filepath