Esempio n. 1
0
    def testRegistration(self):
        """
        Test that the procedure registration works properly.
        """
        def myDummyTemplateProcedure(a, b):
            return '{}-{}'.format(a, b)

        self.assertRaises(TemplateProcedureNotFoundError,
                          TemplateProcedure.run, "dummy")
        TemplateProcedure.register("dummy", myDummyTemplateProcedure)
        self.assertIn("dummy", TemplateProcedure.registeredNames())
Esempio n. 2
0
        return "Final"
    # Sent for review
    elif sg_status_list == "sfr":
        return "Work in Progress"
    else:
        return "Work in Progress"


def fileTypeTemplateProcedure(filePath):
    """
    Return a nice name for the file type.
    """
    name, ext = os.path.splitext(filePath)
    if ext == ".mov":
        if name.endswith("_h264"):
            return "H264"
        elif name.endswith("_prores"):
            return "PRORES"
        else:
            return "DNxHD"
    elif ext == ".exr":
        return "EXR"
    else:
        return ext.upper().strip(".")


# registering template procedures
TemplateProcedure.register('clientStatus', clientStatusTemplateProcedure)

TemplateProcedure.register('clientFileType', fileTypeTemplateProcedure)
Esempio n. 3
0
import os
import re
from centipede.TemplateProcedure import TemplateProcedure


def plateNewVersionTemplateProcedure(prefix, job, seq, shot, plateName):
    """
    Returns a new version for the plate.
    """
    plateLocation = "{prefix}/{job}/sequences/{seq}/{shot}/online/publish/elements/{plateName}".format(
        prefix=prefix, job=job, seq=seq, shot=shot, plateName=plateName)

    version = 0
    versionRegEx = "^v[0-9]{3}$"

    # finding the latest version
    if os.path.exists(plateLocation):
        for directory in os.listdir(plateLocation):
            if re.match(versionRegEx, directory):
                version = max(int(directory[1:]), version)

    return 'v' + str(version + 1).zfill(3)


# registering procedure
TemplateProcedure.register('plateNewVersion', plateNewVersionTemplateProcedure)