def exportPanelsCheck(self, settings): log('## exportPanelsCheck') # Using 2 sec per panel should be enough? timeout = len(settings['panels'])*2 if not checkUtils.popupCheck(self.export.testInfo, timeout, 'exportPanelsCheck'): self.export.testInfo.failed('exportPanelsCheck: Plugin failed, ' 'check log for errors. Exiting current checks...') return outputPath = '%s/%ss/' % (self.export.testInfo.outDir, settings['format']) # check panels have been exported to output directory if settings['format'] == 'jpeg': ext = 'jpg' elif settings['format'] == 'psd': ext = 'psd' exported = pyUtils.countFiles(outputPath, '%s_%s_*.%s' % (self.export.testInfo.show, self.export.testInfo.sequence, ext)) if not exported == len(settings['panels']): self.export.testInfo.failed( 'exportPanelsCheck: Not the right number of %ss ' 'have been exported. Expected %s, found %s instead.' % (ext, len(settings['panels']), exported)) else: log('- Found all expected %ss.' % ext) log('All checks performed for exportPanels.')
def newAudioFile(testInfo, methodName="methodName"): """Checks if there's a new audio file in the flix/editorial/mp3 directory :param testInfo: TestInfo object :param methodName: Name of the method calling me, useful for logging :return: None """ mp3Dir = "%s/mp3/" % testInfo.getEditorialDir() allMp3s = pyUtils.countFiles(mp3Dir, "*.mp3") if allMp3s != testInfo.allAudio + 1: testInfo.failed( "%s: Found %s new audio file(s) in the mp3 directory; expected 1 instead.\nmp3 directory: %s" % (methodName, allMp3s, mp3Dir) ) else: log("- Found new audio file in mp3 directory.")
def importAudio(self, filename="newWorld.mp3", timeout=100): log('##### importAudio') self.testInfo.allAudio = pyUtils.countFiles(self.mp3Dir, '*.mp3') path = "%s/%s" % (self.audioAssetsDir, filename) if not os.path.exists(path): log('importAudio: the audio file specified does not exist, exiting.\naudio file: %s' % path, 'error') return click('importDrawingsButton.png') if not exists('importFileBrowserFilename.png', 10): log('importAudio: Could not find importFileBrowserFilename after 10 seconds.', 'error') click('importFileBrowserFilename.png') type(path.replace('/', '\\')); wait(1) type(sikuli.Key.ENTER); wait(1) self.importDrawingCheck.importAudioCheck(timeout)
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()
def publishSequencerCheck(self, mayaSettings): """After publishing a Maya sequencer to Flix, this methods checks that there's a new version of the sequence, there's a new audio file from the publish, there's a new movie for each new shot from the sequencer, all the new panels are in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for each new panel. :param mayaSettings: Dictionary created using readMayaSettings method :return: None """ log('## publishSequencerCheck') expectedDur = 0 for shotDuration in mayaSettings["shotDurations"]: expectedDur += shotDuration # Assume 2sec/frame as a timeout timeout = 2*expectedDur # Right now there's no popup or nothing processing, so no way to know until it's done # The best thing to do is wait until a new shotEdit gets created! currentShotEdit = self.fromMaya.testInfo.getShotEdit() currentVersion = self.fromMaya.testInfo.getEditVersion() newShotEdit = currentShotEdit.replace('_v%s.xml' % currentVersion, '_v%s.xml' % (currentVersion+1)) if pyUtils.waitForFile('/'.join(newShotEdit.split('/')[0:-1]) + '/', newShotEdit.split('/')[-1], timeout) == 0: self.fromMaya.testInfo.failed('publishSequencerCheck: Could not find v%s of the shotEdit after %s seconds.' % (currentVersion+1, timeout)) return else: log('- Found shotEdit for the new version of the edit.') self.fromMaya.testInfo.incrementEditVersion() self.fromMaya.testInfo.resetEdit() # Load latest version editorialDir = self.fromMaya.testInfo.getEditorialDir() # Check there's audio checkUtils.newAudioFile(self.fromMaya.testInfo, methodName="publishSequencerCheck") # Check the movie was copied movDir = '%smov/' % editorialDir nMovies = pyUtils.countFiles(movDir, '*.mov') if nMovies != (self.fromMaya.testInfo.publishedMovs + 1): self.fromMaya.testInfo.failed('publishSequencerCheck: Could not find the movie copied to the editorial/mov/ directory.' 'Expected %s movies, found %s instead.' % (self.fromMaya.testInfo.publishedMovs+1, nMovies)) else: log('- Found the movie copied in the editorial/mov directory.') self.fromMaya.testInfo.publishedMovs += 1 # Check there's nShot panels in the shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'a': mayaSettings["nShots"]}, methodName='publishSequencerCheck', beats=['a']) # Jpegs finish rendering after the shotEdit XML is created, so we need to wait some more before checking every # panel has its jpeg. Assuming 0.5 sec/frame for this sikuli.wait(int(expectedDur/2)) checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'publishSequencerCheck') foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('addSequencerShotsCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration found to be %s as expected.' % foundDur) self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for publishSequencer.')