예제 #1
0
class FromEditorial:
    def __init__(self, testInfo, launch):
        self.testInfo = testInfo
        self.launch = launch
        self.projectBrowser = self.launch.projectBrowser
        self.editorialProjectBrowser = ProjectBrowser(self.testInfo)
        self.assetsDir = "%s/assets/fromEditorial" % self.testInfo.testPath
        self.editorialDir = self.testInfo.getEditorialDir()
        self.mp3Dir = "%s/mp3" % self.editorialDir
        self.movDir = "%s/mov" % self.editorialDir
        self.fromEditorialCheck = FromEditorialCheck(self)

    def publishToFlix2(self, comment="Publish to Flix", assetName="refsFromPremiere", toShotgun=False, branch="main", asStills=True):
        log('##### publishToFlix')
        branch = "main"
        log("publishToFlix: branch set to 'main' by default as other branches aren't supported yet")
        self.testInfo.allAudio = pyUtils.countFiles(self.mp3Dir, "*.mp3")
    
        self.launch.openEditorialGUI(20, True)
        self.editorialProjectBrowser.selectEditorialProject()
    
        click(sikuli.Pattern('toAvidToFlix.png').targetOffset(20, 0)); wait(1)
        type(sikuli.Key.TAB); wait(1)
        type(sikuli.Key.TAB); wait(1)
        type(sikuli.Key.TAB); wait(1)
    
        movPath = "%s/%s.mov" % (self.assetsDir, assetName)
        type(movPath)
    
        type(sikuli.Key.TAB); wait(1)
        edlPathBase = "%s/%s" % (self.assetsDir, assetName)
        edlPathAvid = "%s.txt" % edlPathBase
        edlPathFcp = "%s.xml" % edlPathBase
        if os.path.exists(edlPathAvid):
            edlPath = edlPathAvid
        elif os.path.exists(edlPathFcp):
            edlPath = edlPathFcp
        else:
            log("publishToFlix: Could not find EDL file for %s editorial asset." % assetName, "error")
            # Close the Editorial GUI
            sikuliUtils.closeChromeTab()
            # Come back to Flix
            self.launch.openFlixGUI(10)
            self.projectBrowser.loadShow()
            self.projectBrowser.loadSequence()
            click("loadLatestVersion.png")
            return
    
        # settings['edl'] = edlPath
        type(edlPath)
    
        type(sikuli.Key.TAB); wait(1)
        if toShotgun:
            type(sikuli.Key.SPACE); wait(1)
    
        type(sikuli.Key.TAB); wait(1)
        if branch != "main":
            type(sikuli.Key.ENTER); wait(1)
    
        type(sikuli.Key.TAB); wait(1)
        if not asStills:
            type(sikuli.Key.SPACE); wait(1)
    
        type(sikuli.Key.TAB); wait(1)
        type(comment); wait(1)
    
        type(sikuli.Key.TAB); wait(1)
        type(sikuli.Key.ENTER)
    
        loadLatestVersion = self.fromEditorialCheck.publishToFlixCheck2(comment, assetName, toShotgun, branch, asStills)
    
        # Close the Editorial GUI
        sikuliUtils.closeChromeTab()
        # Come back to Flix
        self.launch.openFlixGUI(10)
        self.projectBrowser.loadShow()
        self.projectBrowser.loadSequence()
        if branch != "main" and loadLatestVersion:
            self.projectBrowser.switchToBranch(branch)
        elif loadLatestVersion:
            click('loadLatestVersion.png')
        else:
            self.projectBrowser.createCleanVersion()
예제 #2
0
class ToEditorial:
    def __init__(self, testInfo, launch):
        log("Constructing ToEditorial object...", "debug")
        self.testInfo = testInfo
        self.launch = launch
        self.projectBrowser = self.launch.projectBrowser
        self.editorialProjectBrowser = ProjectBrowser(self.testInfo)
        self.editorialDir = self.testInfo.getEditorialDir()
        self.fcpDir = "%s/fcp" % self.editorialDir
        self.sbpDir = "%s/sbp" % self.editorialDir
        self.aafDir = "%s/aaf" % self.editorialDir
        self.aleDir = "%s/ale" % self.editorialDir
        self.sgDir = '%s/flix/shotgun/published/' % self.testInfo.getSequenceDir()
        self.toAvidOutputDir = "%s/toAvid/" % self.testInfo.outDir
        self.toEditorialCheck = ToEditorialCheck(self)
        log("Done!", "debug")

    # Private Methods
    def __publishFromFlix(self, methodName, comment, checkMethod, windowName="fcp", importAAFs=False, createSgSeq=False):
        """Method that will select the specified editorial plugin, publish with a comment and call the relevant check
        method

        :param methodName: Name of the method calling me
        :param comment: Comment to add to the publish
        :param checkMethod: Method to call to check the publish results
        :param windowName: Name of the Explorer window Flix reveals after publishing
        :param importAAFs: Set to True to import AAFs after Avid publish (not relevant for other editorial publishes)
        :param createSgSeq: Set to True to create the Flix sequence in Shotgun (only relevant for Shotgun publish)
        :return: None
        """
        log("##### toEditorial: %s" % methodName)

        if methodName == "toShotgun" and createSgSeq:
            sikuliUtils.createShotgunSequence(self.testInfo)

        if self.testInfo.flixVersion < '5.2':
            click(sikuliUtils.switchPlugin('editorial', '%s.png' % methodName)); wait(1)
        else:
            sikuliUtils.switchPlugin('editorial', '%s.png' % methodName); wait(1)

        click('publishComment.png'); wait(1)

        type(comment); wait(1)
        type(sikuli.Key.TAB); wait(.5)
        type(sikuli.Key.ENTER)

        # Assuming .5 sec/frame is enough to publish an edit to editorial
        # timeout = self.testInfo.getDurationFromShotEdit()/2
        # Assuming 2 sec/panel for stills and 1.5 sec/frame for animated panels is enough to publish an edit
        stillPanels = len(self.testInfo.editPanels["p"]) + len(self.testInfo.editPanels["s"])
        animPanels = self.testInfo.editPanels["a"]
        animFrames = 0
        for panel in animPanels:
            animFrames += self.testInfo.getPanelDurationFromShotEdit(panel)
        if methodName == "toAvid":
            stillTimeout = 2
            animFrameTimeout = 1.5
        else:
            stillTimeout = 0.5
            animFrameTimeout = 0.5
        timeout = int((stillTimeout*stillPanels) + (animFrameTimeout*animFrames))
        if timeout < 20:
            timeout = 20

        checkMethod(timeout)

        if methodName in ["toSbp", "toPremiere"]:
            sikuliUtils.closeExplorerWindow("%s" % windowName)
        elif importAAFs:
            self.launch.openEditorialGUI(10)
            self.editorialProjectBrowser.selectEditorialProject()
            self.__importToAvid()

    def __importToAvid(self):
        """Imports the AAFs, ALE and marker.txt files that were created when publishing to Avid

        :return: None
        """
        log('##### importToAvid')

        if os.path.isdir(self.toAvidOutputDir):
            try:
                shutil.rmtree(self.toAvidOutputDir)
            except OSError, e:
                log('importToAvid: Could not delete %s.\n%s' % (self.toAvidOutputDir, e), 'debug')

        os.makedirs(self.toAvidOutputDir)

        for _ in range(8):
            type(sikuli.Key.TAB); wait(.5)
        type(self.toAvidOutputDir); wait(1)

        click('aafImport.png')

        self.toEditorialCheck.importToAvidCheck()

        sikuliUtils.closeExplorerWindow('%s_shotEdit_v%s.xml' % (self.testInfo.sequence, self.testInfo.mainVersion))

        # Close the Editorial GUI
        sikuliUtils.closeChromeTab()